Skip to main content

Python package equipped with a procedures to process data streams using estimators with API compatible with scikit-learn.

Project description

stream-learn

Travis Status Coverage Status CircleCI Status

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


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)

Uploaded Source

Built Distribution

stream_learn-0.8.4-py3-none-any.whl (39.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page