civisml-extensions
scikit-learn-compatible estimators from Civis Analytics
Installation
Installation with pip is recommended:
$ pip install civisml-extensions
For development, a few additional dependencies are needed:
$ pip install -r dev-requirements.txt
Contents and Usage
This package contains scikit-learn-compatible estimators for stacking ( StackedClassifier, StackedRegressor), non-negative linear regression ( NonNegativeLinearRegression), preprocessing pandas DataFrames ( DataFrameETL), and using Hyperband for cross-validating hyperparameters ( HyperbandSearchCV).
Usage of these estimators follows the standard sklearn conventions. Here is an example of using the StackedClassifier:
>>> from sklearn.linear_model import LogisticRegression >>> from sklearn.ensemble import RandomForestClassifier >>> from civismlext.stacking import StackedClassifier >>> >>> # Define some Train data and labels >>> Xtrain, ytrain = <train_features>, <train_labels> >>> >>> # Note that the final estimator 'metalr' is the meta-estimator >>> estlist = [('rf', RandomForestClassifier()), >>> ('lr', LogisticRegression()), >>> ('metalr', LogisticRegression())] >>> >>> mysm = StackedClassifier(estlist) >>> # Set some parameters, if you didn't set them at instantiation >>> mysm.set_params(rf__random_state=7, lr__random_state=8, >>> metalr__random_state=9, metalr__C=10**7) >>> >>> # Fit >>> mysm.fit(Xtrain, ytrain) >>> >>> # Predict! >>> ypred = mysm.predict_proba(Xtest)
You can learn more about stacking and see an example use of the StackedRegressor and NonNegativeLinearRegression estimators in a talk presented at PyData NYC in November, 2017.
See the doc strings of the various estimators for more information.
Contributing
Please see CONTRIBUTING.md for information about contributing to this project.
License
BSD-3
See LICENSE.md for details.
Metadata
Release files for civisml-extensions 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| civisml-extensions-0.3.1.tar.gz | 37.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| civisml_extensions-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 77.0 kB
Release files / civisml-extensions-0.3.1.tar.gz
| Download URL | civisml-extensions-0.3.1.tar.gz |
|---|---|
| Size | 37.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e29ad3b853cc43551dc9bbad22f83ce387ca602b20200251fea90d7c6eda53e6
|
|
BLAKE2b-256 checksum How to use checksums |
66c00bae3015c5a38298bc8dfff4fb21f94dd2dd8af5962a169e0636d9f62198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.0
|
Release files / civisml_extensions-0.3.1-py3-none-any.whl
| Download URL | civisml_extensions-0.3.1-py3-none-any.whl |
|---|---|
| Size | 39.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f4d9cb0c8ec2ed4dbeb47950b4cdd2db197089c4520d909d2ecea98ef8c4d36
|
|
BLAKE2b-256 checksum How to use checksums |
8bb488a589ec894ea27f7506de580df1f0fe3c8d2b634547bbbd3cd691d8eb60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.0
|