| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
River is a Python library for online machine learning. It is the result of a merger between creme and scikit-multiflow. River's ambition is to be the go-to library for doing machine learning on streaming data.
As a quick example, we'll train a logistic regression to classify the website phishing dataset. Here's a look at the first observation in the dataset.
>>> from pprint import pprint
>>> from river import datasets
>>> dataset = datasets.Phishing()
>>> for x, y in dataset:
... pprint(x)
... print(y)
... break
{'age_of_domain': 1,
'anchor_from_other_domain': 0.0,
'empty_server_form_handler': 0.0,
'https': 0.0,
'ip_in_url': 1,
'is_popular': 0.5,
'long_url': 1.0,
'popup_window': 0.0,
'request_from_other_domain': 0.0}
TrueNow let's run the model on the dataset in a streaming fashion. We sequentially interleave predictions and model updates. Meanwhile, we update a performance metric to see how well the model is doing.
>>> from river import compose
>>> from river import linear_model
>>> from river import metrics
>>> from river import preprocessing
>>> model = compose.Pipeline(
... preprocessing.StandardScaler(),
... linear_model.LogisticRegression()
... )
>>> metric = metrics.Accuracy()
>>> for x, y in dataset:
... y_pred = model.predict_one(x) # make a prediction
... metric = metric.update(y, y_pred) # update the metric
... model = model.learn_one(x, y) # make the model learn
>>> metric
Accuracy: 89.20%River is intended to work with Python 3.6 or above. Installation can be done with pip:
pip install riverThere are wheels available for Linux, MacOS, and Windows, which means that you most probably won't have to build River from source.
You can install the latest development version from GitHub as so:
pip install git+https://github.com/online-ml/river --upgradeOr, through SSH:
pip install git+ssh://git@github.com/online-ml/river.git --upgradeMachine learning is often done in a batch setting, whereby a model is fitted to a dataset in one go. This results in a static model which has to be retrained in order to learn from new data. In many cases, this isn't elegant nor efficient, and usually incurs a fair amount of technical debt. Indeed, if you're using a batch model, then you need to think about maintaining a training set, monitoring real-time performance, model retraining, etc.
With River, we encourage a different approach, which is to continuously learn a stream of data. This means that the model process one observation at a time, and can therefore be updated on the fly. This allows to learn from massive datasets that don't fit in main memory. Online machine learning also integrates nicely in cases where new data is constantly arriving. It shines in many use cases, such as time series forecasting, spam filtering, recommender systems, CTR prediction, and IoT applications. If you're bored with retraining models and want to instead build dynamic models, then online machine learning (and therefore River!) might be what you're looking for.
Here are some benefits of using River (and online machine learning in general):
Feel free to contribute in any way you like, we're always open to new ideas and approaches.
There are three ways for users to get involved:
Please check out the contribution guidelines if you want to bring modifications to the code base. You can view the list of people who have contributed here.
These are companies that we know have been using River, be it in production or for prototyping.
Feel welcome to get in touch if you want us to add your company logo!
Sponsors
Collaborating institutions and groups
If river has been useful for your research and you would like to cite it in an scientific publication, please refer to this paper:
@misc{2020river,
title={River: machine learning for streaming data in Python},
author={Jacob Montiel and Max Halford and Saulo Martiello Mastelini
and Geoffrey Bolmier and Raphael Sourty and Robin Vaysse
and Adil Zouitine and Heitor Murilo Gomes and Jesse Read
and Talel Abdessalem and Albert Bifet},
year={2020},
eprint={2012.04740},
archivePrefix={arXiv},
primaryClass={cs.LG}
}River is free and open-source software licensed under the 3-clause BSD license.
| Back | FazBrowse Home | New Git URL |