skillfed

river

Online machine learning in Python

river v0.25.0 213.4K downloads/30d#9,437 on PyPI5,916
Permissive license BSD-3-Clause Active released

What it is and what it does

River is a Python library for online machine learning on streaming data, designed for scenarios where models must learn continuously from new observations without revisiting historical data. It implements a wide range of algorithms—linear models, decision trees, random forests, nearest neighbors, anomaly detection, clustering, and time series forecasting—all optimized for the online learning paradigm where predictions and model updates interleave on single samples.

The library emphasizes user-friendliness and clarity over raw performance, with a core interface (`learn_one`/`predict_one`) that has no pandas dependency. It depends on scipy, numpy, and altair for visualization. River targets scenarios where concept drift matters, where production systems are event-driven, or where you need a model that adapts to new data without batch retraining. It requires Python 3.11 or above.

Use it for:

  • Real-time fraud detection systems that adapt to evolving fraud patterns without retraining on historical data
  • Sensor data anomaly detection in IoT deployments where data arrives continuously and must be processed one observation at a time
  • Adaptive recommendation systems that learn user preferences from streaming interaction events
  • Time series forecasting for stock prices or weather data where concept drift is common
  • Online clustering of streaming data for customer segmentation that evolves over time
  • Model validation and evaluation in production contexts where data distribution may shift

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

River provides online machine learning algorithms that learn from streaming data one sample at a time, including linear models, decision trees, anomaly detection, clustering, and time series forecasting.

Yes. River is worth installing if you need online machine learning on streaming data—a genuinely different problem from batch learning. Active maintenance, no known vulnerabilities, permissive licensing, and prebuilt wheels across platforms make it low-friction. Start with it if concept drift, event-driven learning, or single-sample-at-a-time processing matches your use case; skip it if standard batch learning suffices.

Install

river on PyPI

pip

pip install river

uv

uv add river

poetry

poetry add river

Installing river

Before you install

Medium install friction with prebuilt wheels for Python 3.11+ across Linux, macOS, and Windows. Active maintenance with a recent release (75 days ago) and 5916 repository stars. Core functionality has no pandas dependency; pandas support is opt-in.

License in practice

BSD-3-Clause permissive license allows commercial use, modification, and distribution with minimal restrictions, making it suitable for most production and research contexts.

Quickstart

pip install river

from river import compose, linear_model, metrics, preprocessing

model = compose.Pipeline(
    preprocessing.StandardScaler(),
    linear_model.LogisticRegression()
)
metric = metrics.Accuracy()

for x, y in dataset:
    y_pred = model.predict_one(x)
    metric.update(y, y_pred)
    model.learn_one(x, y)

Requires Python 3.11 or above. Development installation from source requires Cython and Rust.

Verify before relying

  • Performance characteristics compared to batch learning libraries for specific use cases
  • Memory footprint and scalability limits for very high-frequency streaming scenarios
  • Maturity and stability of individual algorithm implementations within the library

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.11)
Install friction medium — platform-specific wheel
Runtime dependencies 3 — scipy, numpy, altair
Maintenance actively maintained — 75 days since the last release
Last repo commit
First released
Downloads 213,412/month — #9,437 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: river-0.25.0-cp311-cp311-macosx_10_13_universal2.whl; river-0.25.0-cp311-cp311-manylinux_2_28_aarch64.whl; river-0.25.0-cp311-cp311-manylinux_2_28_x86_64.whl; river-0.25.0-cp311-cp311-musllinux_1_2_aarch64.whl; river-0.25.0-cp311-cp311-musllinux_1_2_x86_64.whl; river-0.25.0-cp311-cp311-win_amd64.whl; river-0.25.0-cp312-cp312-macosx_10_13_universal2.whl; river-0.25.0-cp312-cp312-manylinux_2_28_aarch64.whl; river-0.25.0-cp312-cp312-manylinux_2_28_x86_64.whl; river-0.25.0-cp312-cp312-musllinux_1_2_aarch64.whl; river-0.25.0-cp312-cp312-musllinux_1_2_x86_64.whl; river-0.25.0-cp312-cp312-win_amd64.whl; river-0.25.0-cp313-cp313-macosx_10_13_universal2.whl; river-0.25.0-cp313-cp313-manylinux_2_28_aarch64.whl; river-0.25.0-cp313-cp313-manylinux_2_28_x86_64.whl; river-0.25.0-cp313-cp313-musllinux_1_2_aarch64.whl; river-0.25.0-cp313-cp313-musllinux_1_2_x86_64.whl; river-0.25.0-cp313-cp313-win_amd64.whl; river-0.25.0-cp314-cp314-macosx_10_15_universal2.whl; river-0.25.0-cp314-cp314-manylinux_2_28_aarch64.whl

Tags

online machine learning streamingincremental learning algorithmsconcept drift detectiononline classification regressionstream processing machine learningone-sample-at-a-time learningevent-based model training
streaming-mlconcept-driftonline-learning

More Artificial Intelligence packages