Skip to main content

civisml-extensions

https://www.travis-ci.org/civisanalytics/civisml-extensions.svg?branch=master

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)

Source distribution for civisml-extensions 0.3.1
File Size Uploaded
civisml-extensions-0.3.1.tar.gz 37.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for civisml-extensions 0.3.1
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page