A package for optimization solvers
Project description
elex-solver
This packages includes solvers for:
- Ordinary least squares regression
- Quantile regression
- Transition matrices
Installation
- We recommend that you set up a virtualenv and activate it (IE
mkvirtualenv elex-solver
via http://virtualenvwrapper.readthedocs.io/en/latest/). - Run
pip install elex-solver
Ordinary least squares
We have our own implementation of ordinary least squares in Python because this let us optimize it towards the bootstrap by storing and re-using the normal equations. This allows for significant speed up.
Quantile Regression
Since we did not find any implementations of quantile regression in Python that fit our needs, we decided to write one ourselves. At the moment this uses two libraries, the version that solves the non-regularized problem uses numpy
and solves the dual based on this paper. The version that solves the regularized problem uses cvxpy
and sets up the problem as a normal optimization problem. Eventually, we are planning on replacing the regularized version with the dual also.
Transition matrices
We also have a solver for transition matrices. While this works arbitrarily, we have used this in the past for our primary election night model. We can still use this to create the sankey diagram coefficients.
Development
We welcome contributions to this repo. Please open a Github issue for any issues or comments you have.
Set up a virtual environment and run:
> pip install -r requirements.txt
> pip install -r requirements-dev.txt
Precommit
To run pre-commit for linting, run:
pre-commit run --all-files
Testing
> tox
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file elex-solver-2.0.0.tar.gz
.
File metadata
- Download URL: elex-solver-2.0.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da291d751bdaf25d37e559381550939e351e4a59d3dfe8bb86299f077d7190bf |
|
MD5 | 99e7dbf09c92b1a8b85f8b6103d25814 |
|
BLAKE2b-256 | a460c02f51e4049d0e4e720129216376588954344f5115c955c5d9cf40737b0e |
File details
Details for the file elex_solver-2.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: elex_solver-2.0.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bff4c79a19ea4774db24437a6e46412188646fe932eb42316ea6d8e5645f0580 |
|
MD5 | d2dbf9779b6fe89b590d25b2859ee1f7 |
|
BLAKE2b-256 | 68ce04b76aa9104f56931c20201e62046e4170c59e4082c777dc91a1628b47f3 |