online-ml/river

🌊 Online machine learning in Python

What it solves

River solves the problem of training machine learning models on streaming data. Unlike traditional batch learning, where a model is trained on a fixed dataset, River allows models to learn from new data points one by one, without needing to revisit past data. This makes it particularly useful for scenarios where data arrives in a continuous stream and the model needs to be robust to "concept drift" (changes in the data distribution over time).

How it works

River implements an online learning interface (learn_one / predict_one) that processes samples sequentially. It provides a wide array of algorithms—including linear models, decision trees, and anomaly detection—that are designed to update their parameters based on a single observation at a time. It also supports mini-batch processing via an optional pandas dependency for those who need to process data in small groups.

Who it’s for

It is designed for developers and data scientists who need to implement machine learning on event-based production contexts or who want to models that can adapt to new data without retraining from scratch.

Highlights

  • Comprehensive Algorithm Suite: Includes linear models, random forests, nearest neighbors, anomaly and drift detection, and recommender systems.
  • User-Friendly API: Focuses on clarity and user experience, providing a model pipeline system similar to scikit-learn.
  • Online Utilities: Provides built-in datasets, online statistics, metrics, and preprocessing tools specifically for streaming data.
  • Lightweight Core: The core interface has no dependency on pandas, making it fast for single-sample processing.

Related

  • Project
  • Project
  • Project
  • Project
  • Project