{"id":13465674,"url":"https://github.com/online-ml/river","last_synced_at":"2026-04-14T23:11:47.528Z","repository":{"id":37212181,"uuid":"167388434","full_name":"online-ml/river","owner":"online-ml","description":"🌊 Online machine learning in Python","archived":false,"fork":false,"pushed_at":"2025-04-27T12:41:17.000Z","size":330721,"stargazers_count":5319,"open_issues_count":133,"forks_count":573,"subscribers_count":84,"default_branch":"main","last_synced_at":"2025-05-06T19:52:03.386Z","etag":null,"topics":["concept-drift","data-science","incremental-learning","machine-learning","online-learning","online-machine-learning","online-statistics","python","real-time-processing","stream-processing","streaming","streaming-data"],"latest_commit_sha":null,"homepage":"https://riverml.xyz","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/online-ml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.bib","codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"MaxHalford"}},"created_at":"2019-01-24T15:18:26.000Z","updated_at":"2025-05-06T15:53:51.000Z","dependencies_parsed_at":"2022-07-14T08:17:28.857Z","dependency_job_id":"b726a267-4bbb-448b-9359-08ca650f3a04","html_url":"https://github.com/online-ml/river","commit_stats":{"total_commits":3174,"total_committers":105,"mean_commits":"30.228571428571428","dds":0.5775047258979207,"last_synced_commit":"df9cdfe756fab424563f6205b25ed8bcb0111fe2"},"previous_names":["creme-ml/creme"],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/online-ml%2Friver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/online-ml%2Friver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/online-ml%2Friver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/online-ml%2Friver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/online-ml","download_url":"https://codeload.github.com/online-ml/river/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020478,"owners_count":22000750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["concept-drift","data-science","incremental-learning","machine-learning","online-learning","online-machine-learning","online-statistics","python","real-time-processing","stream-processing","streaming","streaming-data"],"created_at":"2024-07-31T15:00:33.692Z","updated_at":"2026-04-14T23:11:47.520Z","avatar_url":"https://github.com/online-ml.png","language":"Python","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg height=\"220px\" src=\"https://github.com/online-ml/river/assets/8095957/64ad5fb6-383c-4bfb-af71-3d055a103a1a\" alt=\"river_logo\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003c!-- Code quality --\u003e\n  \u003ca href=\"https://github.com/online-ml/river/actions/workflows/code-quality.yml\"\u003e\n    \u003cimg src=\"https://github.com/online-ml/river/actions/workflows/code-quality.yml/badge.svg\" alt=\"code-quality\"\u003e\n  \u003c/a\u003e\n  \u003c!-- Documentation --\u003e\n  \u003ca href=\"https://riverml.xyz\"\u003e\n    \u003cimg src=\"https://img.shields.io/website?label=docs\u0026style=flat-square\u0026url=https%3A%2F%2Friverml.xyz%2F\" alt=\"documentation\"\u003e\n  \u003c/a\u003e\n  \u003c!-- PyPI --\u003e\n  \u003ca href=\"https://pypi.org/project/river\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/river.svg?label=release\u0026color=blue\u0026style=flat-square\" alt=\"pypi\"\u003e\n  \u003c/a\u003e\n  \u003c!-- PePy --\u003e\n  \u003ca href=\"https://pepy.tech/project/river\"\u003e\n    \u003cimg src=\"https://static.pepy.tech/badge/river?style=flat-square\" alt=\"pepy\"\u003e\n  \u003c/a\u003e\n  \u003c!-- Mypy --\u003e\n  \u003ca href=\"http://mypy-lang.org/\"\u003e\n    \u003cimg src=\"http://www.mypy-lang.org/static/mypy_badge.svg\" alt=\"mypy\"\u003e\n  \u003c/a\u003e\n  \u003c!-- License --\u003e\n  \u003ca href=\"https://opensource.org/licenses/BSD-3-Clause\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-BSD%203--Clause-blue.svg?style=flat-square\" alt=\"bsd_3_license\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003c/br\u003e\n\n\u003cp align=\"center\"\u003e\n  River is a Python library for \u003ca href=\"https://www.wikiwand.com/en/Online_machine_learning\"\u003eonline machine learning\u003c/a\u003e. It aims to be the most user-friendly library for doing machine learning on streaming data. River is the result of a merger between \u003ca href=\"https://github.com/MaxHalford/creme\"\u003ecreme\u003c/a\u003e and \u003ca href=\"https://github.com/scikit-multiflow/scikit-multiflow\"\u003escikit-multiflow\u003c/a\u003e.\n\u003c/p\u003e\n\n## ⚡️ Quickstart\n\nAs a quick example, we'll train a logistic regression to classify the [website phishing dataset](http://archive.ics.uci.edu/ml/datasets/Website+Phishing). Here's a look at the first observation in the dataset.\n\n```python\n\u003e\u003e\u003e from pprint import pprint\n\u003e\u003e\u003e from river import datasets\n\n\u003e\u003e\u003e dataset = datasets.Phishing()\n\n\u003e\u003e\u003e for x, y in dataset:\n...     pprint(x)\n...     print(y)\n...     break\n{'age_of_domain': 1,\n 'anchor_from_other_domain': 0.0,\n 'empty_server_form_handler': 0.0,\n 'https': 0.0,\n 'ip_in_url': 1,\n 'is_popular': 0.5,\n 'long_url': 1.0,\n 'popup_window': 0.0,\n 'request_from_other_domain': 0.0}\nTrue\n\n```\n\nNow 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.\n\n```python\n\u003e\u003e\u003e from river import compose\n\u003e\u003e\u003e from river import linear_model\n\u003e\u003e\u003e from river import metrics\n\u003e\u003e\u003e from river import preprocessing\n\n\u003e\u003e\u003e model = compose.Pipeline(\n...     preprocessing.StandardScaler(),\n...     linear_model.LogisticRegression()\n... )\n\n\u003e\u003e\u003e metric = metrics.Accuracy()\n\n\u003e\u003e\u003e for x, y in dataset:\n...     y_pred = model.predict_one(x)      # make a prediction\n...     metric.update(y, y_pred)           # update the metric\n...     model.learn_one(x, y)              # make the model learn\n\n\u003e\u003e\u003e metric\nAccuracy: 89.28%\n\n```\n\nOf course, this is just a contrived example. We welcome you to check the [introduction](https://riverml.xyz/dev/introduction/installation/) section of the documentation for a more thorough tutorial.\n\n## 🛠 Installation\n\nRiver is intended to work with **Python 3.10 and above**. Installation can be done with `pip`:\n\n```sh\npip install river\n```\n\nThere are [wheels available](https://pypi.org/project/river/#files) for Linux, MacOS, and Windows. This means you most probably won't have to build River from source.\n\nYou can install the latest development version from GitHub as so:\n\n```sh\npip install git+https://github.com/online-ml/river --upgrade\npip install git+ssh://git@github.com/online-ml/river.git --upgrade  # using SSH\n```\n\nThis method requires having Cython and Rust installed on your machine.\n\n## 🔮 Features\n\nRiver provides online implementations of the following family of algorithms:\n\n- Linear models, with a wide array of optimizers\n- Decision trees and random forests\n- (Approximate) nearest neighbors\n- Anomaly detection\n- Drift detection\n- Recommender systems\n- Time series forecasting\n- Bandits\n- Factorization machines\n- Imbalanced learning\n- Clustering\n- Bagging/boosting/stacking\n- Active learning\n\nRiver also provides other online utilities:\n\n- Feature extraction and selection\n- Online statistics and metrics\n- Preprocessing\n- Built-in datasets\n- Progressive model validation\n- Model pipelines\n\nCheck out [the API](https://riverml.xyz/latest/api/overview/) for a comprehensive overview\n\n## 🤔 Should I be using River?\n\nYou should ask yourself if you need online machine learning. The answer is likely no. Most of the time batch learning does the job just fine. An online approach might fit the bill if:\n\n- You want a model that can learn from new data without having to revisit past data.\n- You want a model which is robust to [concept drift](https://www.wikiwand.com/en/Concept_drift).\n- You want to develop your model in a way that is closer to what occurs in a production context, which is usually event-based.\n\nSome specificities of River are that:\n\n- It focuses on clarity and user experience, more so than performance.\n- It's very fast at processing one sample at a time. Try it, you'll see.\n- It plays nicely with the rest of Python's ecosystem.\n\n## 🔗 Useful links\n\n- [Documentation](https://riverml.xyz)\n- [Package releases](https://pypi.org/project/river/#history)\n- [awesome-online-machine-learning](https://github.com/online-ml/awesome-online-machine-learning)\n- [2022 presentation at GAIA](https://www.youtube.com/watch?v=nzFTmJnIakk\u0026list=PLIU25-FciwNaz5PqWPiHmPCMOFYoEsJ8c\u0026index=5)\n- [Online Clustering: Algorithms, Evaluation, Metrics, Applications and Benchmarking](https://dl.acm.org/doi/10.1145/3534678.3542600) from [KDD'22](https://kdd.org/kdd2022/).\n\n## 👐 Contributing\n\nFeel free to contribute in any way you like, we're always open to new ideas and approaches.\n\n- [Open a discussion](https://github.com/online-ml/river/discussions/new) if you have any question or enquiry whatsoever. It's more useful to ask your question in public rather than sending us a private email. It's also encouraged to open a discussion before contributing, so that everyone is aligned and unnecessary work is avoided.\n- Feel welcome to [open an issue](https://github.com/online-ml/river/issues/new/choose) if you think you've spotted a bug or a performance issue.\n- Our [roadmap](https://github.com/orgs/online-ml/projects/3?query=is%3Aopen+sort%3Aupdated-desc) is public. Feel free to work on anything that catches your eye, or to make suggestions.\n\nPlease check out the [contribution guidelines](https://github.com/online-ml/river/blob/main/CONTRIBUTING.md) if you want to bring modifications to the code base.\n\n## 🤝 Affiliations\n\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"70%\" src=\"https://docs.google.com/drawings/d/e/2PACX-1vSagEhWAjDsb0c24En_fhWAf9DJZbyh5YjU7lK0sNowD2m9uv9TuFm-U77k6ObqTyN2mP05Avf6TCJc/pub?w=2073\u0026h=1127\" alt=\"affiliations\"\u003e\n\u003c/p\u003e\n\n## 💬 Citation\n\nIf River has been useful to you, and you would like to cite it in a scientific publication, please refer to the [paper](https://www.jmlr.org/papers/volume22/20-1380/20-1380.pdf) published at JMLR:\n\n```bibtex\n@article{montiel2021river,\n  title={River: machine learning for streaming data in Python},\n  author={Montiel, Jacob and Halford, Max and Mastelini, Saulo Martiello\n          and Bolmier, Geoffrey and Sourty, Raphael and Vaysse, Robin and Zouitine, Adil\n          and Gomes, Heitor Murilo and Read, Jesse and Abdessalem, Talel and others},\n  year={2021}\n}\n```\n\n## 📝 License\n\nRiver is free and open-source software licensed under the [3-clause BSD license](https://github.com/online-ml/river/blob/main/LICENSE).\n","funding_links":["https://github.com/sponsors/MaxHalford"],"categories":["Python","Machine Learning Framework","Table of Contents","Others","其他_机器学习与深度学习","Machine Learning Frameworks","Online Machine Learning"],"sub_categories":["General Purpose Framework","Online Machine Learning","General-Purpose Machine Learning"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonline-ml%2Friver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonline-ml%2Friver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonline-ml%2Friver/lists"}