Source-linked AI summary

River: machine learning for streaming data in Python

Jacob Montiel, Max Halford, Saulo Martiello Mastelini, Geoffrey Bolmier, Raphael Sourty, Robin Vaysse, Adil Zouitine, Heitor Murilo Gomes, Jesse Read, Talel Abdessalem, Albert Bifet

arXiv:2012.04740v1cs.LGcs.AIcs.MS

TL;DR

Streaming machine learning must handle continuously generated data without assuming all data is available or storing complete histories. River addresses this gap by merging Creme and scikit-multiflow into a flexible Python library for stream learning. Benchmark tests show performance at least as well as related, more limited methods.

  • Problem

    Batch learning assumes data is available at once, but continuously generated streams can make retraining and historical storage impractical.

  • Method

    River merges Creme and scikit-multiflow and provides compatible online models, transformers, pipelines, dictionary-based representations, and limited mini-batch support.

  • Results

    River performs at least as well as related, more limited methods on benchmark tests.

  • Takeaways & Limitations

    River provides a flexible stream-learning library for applications including classification, regression, clustering, forecasting, and anomaly detection.

  • Takeaways & Limitations

    River’s support for batch-incremental methods is limited, and its dictionary-operation performance assumes stream samples are relatively small.

Abstract

from arXiv · show

River is a machine learning library for dynamic data streams and continual learning. It provides multiple state-of-the-art learning methods, data generators/transformers, performance metrics and evaluators for different stream learning problems. It is the result from the merger of the two most popular packages for stream learning in Python: Creme and scikit-multiflow. River introduces a revamped architecture based on the lessons learnt from the seminal packages. River's ambition is to be the go-to library for doing machine learning on streaming data. Additionally, this open source package brings under the same umbrella a large community of practitioners and researchers. The source code is available at https://github.com/online-ml/river.

1. Introduction

River addresses streaming machine learning, where continuously generated data makes batch retraining and historical storage impractical. It merges Creme and scikit-multiflow into a Python library supporting diverse stream-learning applications.

  • Motivation: Streaming treats data as an infinite sequence, updating models one sample at a time without storing the data.This avoids the batch-learning assumption that all data is available simultaneously.
  • Motivation: Batch models must be retrained from scratch when new data batches arrive, while storing historical data can require impractical resources.The paper gives data-center network logs as an example of potentially impractical storage.
  • Library context: River merges Creme and scikit-multiflow, combining lessons from both projects while providing a mainly Python-based implementation.Some core elements are written in Cython for performance.
  • Supported applications: River supports classification, regression, clustering, representation learning, multi-label and multi-output learning, forecasting, and anomaly detection.

2. Architecture

River’s architecture provides compatible online learning components, dictionary-based stream representations, composable pipelines, and limited support for batch-incremental processing. The design emphasizes flexible processing of one-sample-at-a-time data.

  • Core interface: River models expose learn_one for state updates and task-specific methods for prediction, while transformers use transform_one to transform inputs.Prediction methods include predict_one, predict_proba_one, and score_one depending on the task.
  • Example: The architecture example evaluates a Hoeffding tree classifier on 1,000 Waveform samples with progressive validation, obtaining Accuracy: 77.58%.
  • Data representation: Dictionary structures suit one-sample stream data by supporting named access, mixed data types, feature evolution, and sparse data.The paper notes O(1) lookup and insertion for one-dimensional dictionary data.
  • Data representation: River extends dictionary structures with Cython-based operations including basic algebra, exponentiation, and dot products.
  • Pipelines: Pipelines chain estimators sequentially, requiring the first n −1 steps to be transformers while allowing a broader range of final estimators.The paper illustrates scaling data before logistic regression using the pipe operator.
  • Incremental learning: River supports mini-batch methods through _many interfaces that accept pandas.DataFrame inputs, alongside instance-incremental _one methods.The library’s batch-incremental support is described as limited.

3. Benchmark

The benchmark evaluates three incremental-learning algorithms on Elec2, finding similar accuracy and processing that is at least as fast, and overall faster, for River models.

  • Benchmark setup: River benchmarks Gaussian Naive Bayes, Logistic Regression, and Hoeffding Tree on the Elec2 dataset.Elec2 contains 45,312 samples and 8 numerical features; processing times average seven runs.
  • Accuracy: All three models show similar accuracy in the benchmark.The comparison is reported in Table 1 for the Elec2 dataset.
  • Processing time: River models process the benchmark at least as fast as the other implementations and are overall faster than them.Processing time includes learning and prediction and is reported in Table 2.

4. Summary

River is designed for the evolving needs of stream-learning practitioners and researchers, with a flexible architecture intended for diverse domains. Benchmark tests show performance at least as good as related, more limited methods.

  • Summary: River targets the stream-learning community and is designed for flexibility and ease of use across industrial applications and academic research.
  • Summary: Benchmark tests show River performs at least as well as related but more limited methods.
  • Summary: River includes incremental-learning methods available in Creme and scikit-multiflow.
Loading 2012.04740v1…