pyensmallen


Namepyensmallen JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryPython bindings for the Ensmallen library.
upload_time2025-03-23 22:58:12
maintainerNone
docs_urlNone
authorApoorva Lal
requires_python>=3.6
licenseMIT License Copyright (c) 2024 Apoorva Lal and contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `pyensmallen`: python bindings for the [`ensmallen`](https://ensmallen.org/) library for numerical optimization

Minimal python bindings for `ensmallen` library. Currently supports
+ L-BFGS, with intended use for optimisation of smooth objectives for m-estimation
+ ADAM (and variants with different step-size routines) - makes use of ensmallen's templatization.
+ Frank-Wolfe, with intended use for constrained optimization of smooth losses
  - constraints are either lp-ball (lasso, ridge, elastic-net) or simplex

See [ensmallen docs](https://ensmallen.org/docs.html) for details. The `notebooks/` directory walks through several statistical examples.

## speed
`pyensmallen` is very fast. A comprehensive set of benchmarks is available in the `benchmarks` directory. The benchmarks are run on an intel 12th gen framework laptop. Benchmarks vary data size (sample size and number of covariates) and parametric family (linear, logistic, poisson) and compare `pyensmallen` with `scipy` and `statsmodels` (I initially also tried to keep `cvxpy` in the comparison set but it was far too slow to be in the running). At large data sizes, pyensmallen is roughly an order of magnitude faster than scipy, which in turn is an order of magnitude faster than statsmodels. So, a single statsmodels run takes around as long as a pyensmallen run that naively uses the nonparametric bootstrap for inference. This makes the bootstrap a viable option for inference in large data settings.

![](benchmarks/library_performance_comparison.png)

## Installation:

__from pypi__

```
pip install pyensmallen
```

__from source__
1. Install `armadillo` and `ensmallen` for your system (build from source, or via conda-forge; I went with the latter)
2. git clone this repository
3. `pip install -e .`
4. Profit? Or at least minimize loss?

__from wheel__
- download the appropriate `.whl` for your system from the more recent release listed in `Releases` and run `pip install ./pyensmallen...` OR
- copy the download url and run `pip install https://github.com/apoorvalal/pyensmallen/releases/download/<version>/pyensmallen-<version>-<pyversion>-linux_x86_64.whl`

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyensmallen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "Apoorva Lal",
    "author_email": "Apoorva Lal <lal.apoorva@gmail.com>, Matthew Wardrop <mpwardrop@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c0/c3/66cb949aad3a2b27f71a2f48f02b60c2c0dc4c2cdd1430acc30d38eac1be/pyensmallen-0.2.1.tar.gz",
    "platform": null,
    "description": "# `pyensmallen`: python bindings for the [`ensmallen`](https://ensmallen.org/) library for numerical optimization\n\nMinimal python bindings for `ensmallen` library. Currently supports\n+ L-BFGS, with intended use for optimisation of smooth objectives for m-estimation\n+ ADAM (and variants with different step-size routines) - makes use of ensmallen's templatization.\n+ Frank-Wolfe, with intended use for constrained optimization of smooth losses\n  - constraints are either lp-ball (lasso, ridge, elastic-net) or simplex\n\nSee [ensmallen docs](https://ensmallen.org/docs.html) for details. The `notebooks/` directory walks through several statistical examples.\n\n## speed\n`pyensmallen` is very fast. A comprehensive set of benchmarks is available in the `benchmarks` directory. The benchmarks are run on an intel 12th gen framework laptop. Benchmarks vary data size (sample size and number of covariates) and parametric family (linear, logistic, poisson) and compare `pyensmallen` with `scipy` and `statsmodels` (I initially also tried to keep `cvxpy` in the comparison set but it was far too slow to be in the running). At large data sizes, pyensmallen is roughly an order of magnitude faster than scipy, which in turn is an order of magnitude faster than statsmodels. So, a single statsmodels run takes around as long as a pyensmallen run that naively uses the nonparametric bootstrap for inference. This makes the bootstrap a viable option for inference in large data settings.\n\n![](benchmarks/library_performance_comparison.png)\n\n## Installation:\n\n__from pypi__\n\n```\npip install pyensmallen\n```\n\n__from source__\n1. Install `armadillo` and `ensmallen` for your system (build from source, or via conda-forge; I went with the latter)\n2. git clone this repository\n3. `pip install -e .`\n4. Profit? Or at least minimize loss?\n\n__from wheel__\n- download the appropriate `.whl` for your system from the more recent release listed in `Releases` and run `pip install ./pyensmallen...` OR\n- copy the download url and run `pip install https://github.com/apoorvalal/pyensmallen/releases/download/<version>/pyensmallen-<version>-<pyversion>-linux_x86_64.whl`\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 Apoorva Lal and contributors.\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "Python bindings for the Ensmallen library.",
    "version": "0.2.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c0c366cb949aad3a2b27f71a2f48f02b60c2c0dc4c2cdd1430acc30d38eac1be",
                "md5": "f1e92ed229b7a5714abcfff986e04af1",
                "sha256": "ebe97654c98ce886cccb157cd1944b3b6c363a203f8d884b67627461905c3719"
            },
            "downloads": -1,
            "filename": "pyensmallen-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f1e92ed229b7a5714abcfff986e04af1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 16676,
            "upload_time": "2025-03-23T22:58:12",
            "upload_time_iso_8601": "2025-03-23T22:58:12.152589Z",
            "url": "https://files.pythonhosted.org/packages/c0/c3/66cb949aad3a2b27f71a2f48f02b60c2c0dc4c2cdd1430acc30d38eac1be/pyensmallen-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-03-23 22:58:12",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pyensmallen"
}
        
Elapsed time: 0.40269s