Python package equipped with a procedures to process data streams using estimators with API compatible with scikit-learn.
Project description
stream-learn
stream-learn is a Python package equipped with a procedures to process data streams using estimators with API compatible with scikit-learn.
Documentation
API documentation with set of examples may be found on the documentation page.
Installation
stream-learn is available on the PyPi and you may install it with pip:
pip install stream-learn
Example usage
import strlearn as sl
from sklearn.neural_network import MLPClassifier
from sklearn.naive_bayes import GaussianNB
# Initialize list of scikit-learn classifiers with partial_fit() function
clf = [MLPClassifier(), GaussianNB()]
# Declare data stream
stream = sl.streams.StreamGenerator(n_chunks=10, n_drifts=1)
# Select vector of metrics
metrics = [sl.utils.metrics.bac, sl.utils.metrics.f_score]
# Initialize evaluator with given metrics
evaluator = sl.evaluators.TestThenTrain(metrics)
# Run evaluator over stream with classifier
evaluator.process(stream, clf)
>>> print(evaluator.scores)
[[[0.29730274 0.29145729]
[0.34494021 0.36097561]
[0.43464118 0.44878049]
[0.42579578 0.36666667]
[0.45569557 0.4171123 ]
[0.47020869 0.44791667]
[0.4645207 0.46534653]
[0.525 0.5177665 ]
[0.4893617 0.46875 ]]
[[0.87701288 0.88038278]
[0.90091448 0.9047619 ]
[0.89930938 0.9047619 ]
[0.85376189 0.82681564]
[0.61521152 0.60913706]
[0.64714185 0.61538462]
[0.64556129 0.62564103]
[0.74 0.74 ]
[0.80820955 0.80597015]]]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stream-learn-0.8.4.tar.gz
(15.7 kB
view hashes)
Built Distribution
Close
Hashes for stream_learn-0.8.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6a712708397b67087a4bdb78b0c67cad93df56d3c18ac2b6d793df18910b950 |
|
MD5 | fd682635896699b52f1ed8e9e1d6531d |
|
BLAKE2b-256 | 979d0f8c0772c4e80599b9db87d61d3113cab6d7f14ab0dd8bed14de32ae8891 |