[Paper Review] stream-learn -- open-source Python library for difficult data stream batch analysis
stream-learn is an open-source Python library built for batch processing of data streams with concept drift and dynamic class imbalance, offering synthetic stream generation, scikit-learn-compatible estimators, and efficient evaluation via Test-Then-Train and Prequential methods. It enables reproducible, high-performance experimentation on imbalanced and drifting data streams with support for recurring and non-recurring drift types and dynamic imbalance ratios.
stream-learn is a Python package compatible with scikit-learn and developed for the drifting and imbalanced data stream analysis. Its main component is a stream generator, which allows to produce a synthetic data stream that may incorporate each of the three main concept drift types (i.e. sudden, gradual and incremental drift) in their recurring or non-recurring versions. The package allows conducting experiments following established evaluation methodologies (i.e. Test-Then-Train and Prequential). In addition, estimators adapted for data stream classification have been implemented, including both simple classifiers and state-of-art chunk-based and online classifier ensembles. To improve computational efficiency, package utilises its own implementations of prediction metrics for imbalanced binary classification tasks.
Motivation & Objective
- To address the lack of open-source, scikit-learn-compatible tools for batch processing of data streams with concept drift and dynamic class imbalance.
- To enable researchers to generate synthetic data streams with controlled, reproducible properties including sudden, gradual, and incremental drifts.
- To support evaluation using established methodologies such as Test-Then-Train and Prequential in a batch-oriented framework.
- To provide efficient, custom-implemented metrics for imbalanced binary classification to improve computational performance.
- To offer state-of-the-art classifier ensembles (e.g., SEA, OnlineBagging, OOB, UOB, WAE) tailored for data stream classification.
Proposed method
- The library implements a StreamGenerator class based on the Madelon model, enabling synthetic data stream creation with configurable drift and imbalance properties.
- It supports three types of concept drift—sudden, gradual, and incremental—each in recurring or non-recurring variants.
- Class imbalance is modeled via a 'weights' parameter that can define static ratios or dynamic oscillations over time using cycle count, spacing, and range parameters.
- The package includes batch-optimized implementations of evaluation metrics for imbalanced classification, improving efficiency over scikit-learn and imbalanced-learn.
- It provides two evaluators: Test-Then-Train and Prequential, both adapted for batch processing to support reproducible experiments.
- It integrates simple classifiers (e.g., Accumulated Samples Classifier) and advanced ensemble methods (e.g., SEA, OnlineBagging, OOB, UOB, WAE) with scikit-learn API compatibility.

Experimental results
Research questions
- RQ1How can synthetic data streams with controlled concept drift and dynamic class imbalance be generated efficiently in Python for reproducible research?
- RQ2To what extent does batch processing of data streams improve computational efficiency compared to online processing in Python?
- RQ3How do state-of-the-art classifier ensembles perform under combined concept drift and dynamic imbalance conditions?
- RQ4Can custom, optimized metrics for imbalanced classification enhance the performance and speed of stream evaluation pipelines?
- RQ5How effective is the stream-learn library in supporting reproducible experimentation with established evaluation methodologies like Test-Then-Train and Prequential?
Key findings
- stream-learn enables the generation of synthetic data streams with multiple drift types—sudden, gradual, and incremental—both recurring and non-recurring—offering fine-grained control over drift dynamics.
- The library supports both static and dynamically changing class imbalance ratios, with the latter implemented via a tuple-based parameterization of cycles, spacing, and range.
- It provides efficient, custom-implemented prediction metrics for imbalanced binary classification, reducing computational overhead compared to standard scikit-learn and imbalanced-learn implementations.
- The library includes stable, open-source implementations of advanced online ensemble methods such as UOB, OOB, and WAE, which were previously unavailable in Python with consistent APIs.
- The integration with scikit-learn ensures seamless compatibility with existing machine learning workflows, enabling plug-and-play use of stream-learn estimators.
- The library has already been successfully used in multiple research projects involving active learning, preprocessing in incremental learning, and dynamic ensemble selection for imbalanced data streams.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.