Datasets & Stream Generators
The stride.datasets subpackage provides streaming data generators, semi-synthetic stream blending tools (Shaker protocol), and external benchmark loaders.
Overview
All generators inherit from BaseDataset and implement a unified generate() interface returning pandas DataFrame feature matrices \(X\) and target series \(y\).
from stride.datasets import (
HyperplaneDriftDataset,
SeaDriftDataset,
RBFDriftDataset,
LinearWeightInversionDriftDataset,
SemiSyntheticDriftDataset,
)
Key Components
| Class / Function | Description |
|---|---|
BaseDataset |
Abstract base class defining the generator contract and windowing parameters. |
HyperplaneDriftDataset |
Continuous rotating hyperplane in \(d\)-dimensional feature space simulating gradual drift. |
SeaDriftDataset |
Abrupt threshold displacement benchmark with noise features. |
RbfDriftDataset |
Moving Gaussian radial basis centroids simulating non-linear cluster displacement. |
LinearWeightInversionDriftDataset |
Feature correlation inversion benchmark testing model attribution sensitivity. |
SemiSyntheticDriftDataset |
Empirical stream splicing under the Shaker protocol (Shaker & Hüllermeier, 2015). |
FeatureMatcher |
Statistical feature alignment via Hungarian Wasserstein mapping or PCA subspace. |
DriftBlender |
Deterministic stream blending with abrupt, gradual, incremental, or harmonic schedules. |
RiverDataset |
Adapter wrapping River streaming benchmark datasets. |
CsvDataset |
Offline loader for tabular CSV streaming datasets with sliding window slicing. |
API Specification
stride.datasets
BaseDataset
Bases: ABC
Abstract base class for all data streams and drift generators.
generate
abstractmethod
Generate the data stream before and after drift.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, Series]
|
Tuple of |
Source code in src/stride/datasets/base.py
get_available_settings
Deprecated: Return available named preset settings for this dataset.
UI presets should be managed by consumer applications (e.g. dashboard.config.dataset_schemas).
Source code in src/stride/datasets/base.py
get_params
get_settings_schema
Deprecated: Return a schema describing the settings for this dataset.
UI schemas should be managed by consumer applications (e.g. dashboard.config.dataset_schemas).
Source code in src/stride/datasets/base.py
DatasetRegistry
Source code in src/stride/datasets/dataset_registry.py
save_dataset
Save a new imported CSV dataset. file_obj: file-like object (e.g. from st.file_uploader) or bytes
Source code in src/stride/datasets/dataset_registry.py
save_semi_synthetic_dataset
Save a semi-synthetic dataset synthesized from two empirical concepts.
Source code in src/stride/datasets/dataset_registry.py
DriftBlender
Blends two concept datasets into a continuous non-stationary stream.
Supports abrupt, gradual (Shaker sigmoidal Bernoulli schedule), incremental (nearest-neighbor linear interpolation), and recurring (periodic harmonic modulation) drift schedules.
Initialize DriftBlender.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
schedule
|
str
|
Transition schedule ("abrupt", "gradual", "incremental", or "recurring"). |
'gradual'
|
n_samples
|
int | None
|
Total stream length. If None, defaults to |
None
|
t_0
|
int | None
|
Inflection point (midpoint) of drift. If None, defaults to |
None
|
w
|
int
|
Transition window width in samples. |
200
|
period
|
int
|
Period length T for recurring schedule. |
500
|
random_state
|
int | None
|
Random seed for deterministic stream generation. |
42
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/stride/datasets/drift_blending.py
blend
Blend Concept A and Concept B according to the configured schedule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X_a
|
DataFrame
|
Aligned feature matrix for Concept A. |
required |
y_a
|
Series
|
Target series for Concept A. |
required |
X_b
|
DataFrame
|
Aligned feature matrix for Concept B. |
required |
y_b
|
Series
|
Target series for Concept B. |
required |
Returns:
| Type | Description |
|---|---|
DriftBlendResult
|
Synthesized stream DataFrame, target Series, concept indicators, |
DriftBlendResult
|
and ground-truth change-point metadata. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If input datasets are empty or column schemas do not match. |
Source code in src/stride/datasets/drift_blending.py
DriftSchedule
Bases: str, Enum
Supported drift transition schedules.
FeatureAlignmentResult
dataclass
FeatureAlignmentResult(
X_a_aligned,
X_b_aligned,
feature_mapping,
aligned_feature_names,
drifting_features,
drift_diagnostics,
)
Result of feature alignment between two datasets.
FeatureMatcher
FeatureMatcher(
match_strategy="exact",
manual_mapping=None,
align_distributions=False,
scaler_type="standard",
scaler_mode="joint",
subspace_components=None,
drift_significance_level=0.05,
random_state=42,
)
Aligns and matches feature spaces between two distinct datasets or cohorts.
Supports exact column matching, user-specified manual dictionary mapping, statistical distribution matching (Wasserstein/KS bipartite assignment), and latent subspace projection via PCA. Also provides distribution normalization (joint or per-concept) and drifting feature identification.
Initialize FeatureMatcher.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
match_strategy
|
str
|
Strategy to align features ("exact", "manual", "statistical", or "subspace"). |
'exact'
|
manual_mapping
|
dict[str, str] | None
|
Mapping dictionary |
None
|
align_distributions
|
bool
|
Whether to apply feature scaling/normalization after alignment. |
False
|
scaler_type
|
str | None
|
Type of scaler: "standard" ( |
'standard'
|
scaler_mode
|
str
|
"joint" to fit scaler across pooled |
'joint'
|
subspace_components
|
int | None
|
Number of latent dimensions for "subspace" strategy.
If None, |
None
|
drift_significance_level
|
float
|
p-value threshold below which a feature is categorized as drifting under KS test. |
0.05
|
random_state
|
int | None
|
Random seed for stochastic operations. |
42
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If an unsupported strategy, scaler type, or scaler mode is provided. |
Source code in src/stride/datasets/feature_matching.py
align
Align feature representations between dataset A and dataset B.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X_a
|
DataFrame
|
Feature matrix of Concept A (pre-drift). |
required |
X_b
|
DataFrame
|
Feature matrix of Concept B (post-drift). |
required |
Returns:
| Type | Description |
|---|---|
FeatureAlignmentResult
|
Dataclass containing aligned DataFrames, column mapping, and drift diagnostics. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If either |
ValueError
|
If input feature DataFrames are empty. |
Source code in src/stride/datasets/feature_matching.py
identify_drifting_features
Evaluate statistical drift between aligned feature distributions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
X_a
|
DataFrame
|
Pre-drift aligned feature matrix. |
required |
X_b
|
DataFrame
|
Post-drift aligned feature matrix. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
Tuple of |
list[str]
|
contains KS-test statistics and p-values per feature. |
Source code in src/stride/datasets/feature_matching.py
HyperplaneDriftDataset
Bases: BaseDataset
generate
generate(
n_samples_before=1000,
n_samples_after=1000,
n_features=2,
n_drift_features=2,
noise_percentage=0.05,
drift_noise_percentage=0.1,
mag_change=0.2,
drift_width=1,
random_seed=42,
**kwargs,
)
Generate synthetic data stream using River's Hyperplane generator.
Both concepts are generated with the same random_seed. For abrupt drift
the post-drift stream therefore starts from the same feature sequence: the
first n_samples_after samples after the drift have exactly the same
features as the first samples of the stream and only their labels differ.
This is intentional and isolates pure concept drift (identical inputs,
changed decision boundary). To compare two independent feature samples,
use windows of at most n_samples_before / 2 samples on each side of
the drift point.
Source code in src/stride/datasets/hyperplane_drift.py
ImportedCSVDataset
Bases: BaseDataset
Source code in src/stride/datasets/imported_dataset.py
generate
Load data from the stored CSV file.
Source code in src/stride/datasets/imported_dataset.py
LinearWeightInversionDriftDataset
Bases: BaseDataset
generate
generate(
n_samples_before=1000,
n_samples_after=1000,
n_features=11,
n_drift_features=5,
random_seed=42,
drift_width=1,
**kwargs,
)
Generate synthetic data with Linear Weight Inversion Drift.
Source code in src/stride/datasets/linear_weight_inversion_drift.py
MixedMultiWindowDataset
Bases: BaseDataset
generate
generate(
num_windows=100,
window_length=1000,
drift_positions=None,
drift_duration=1,
classification_function=1,
random_seed=42,
**kwargs,
)
Generate synthetic data stream using protree's Mixed generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_windows
|
Number of windows to generate. |
100
|
|
window_length
|
Number of samples per window. |
1000
|
|
drift_positions
|
List of sample positions where drifts occur, or comma-separated string. |
None
|
|
drift_duration
|
Duration of drift transition in samples. |
1
|
|
classification_function
|
Classification function (0 or 1). |
1
|
|
random_seed
|
Random seed for reproducibility. |
42
|
|
**kwargs
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
|
Tuple of |
Source code in src/stride/datasets/mixed_multi_window.py
PlaneMultiWindowDataset
Bases: BaseDataset
generate
generate(
num_windows=100,
window_length=1000,
drift_positions=None,
drift_duration=1,
random_seed=42,
**kwargs,
)
Generate synthetic data stream using protree's Plane generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_windows
|
Number of windows to generate. |
100
|
|
window_length
|
Number of samples per window. |
1000
|
|
drift_positions
|
List of sample positions where drifts occur, or comma-separated string. |
None
|
|
drift_duration
|
Duration of drift transition in samples. |
1
|
|
random_seed
|
Random seed for reproducibility. |
42
|
|
**kwargs
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
|
Tuple of |
Source code in src/stride/datasets/plane_multi_window.py
RBFDriftDataset
Bases: BaseDataset
RandomTreeMultiWindowDataset
Bases: BaseDataset
generate
generate(
num_windows=100,
window_length=1000,
drift_positions=None,
drift_duration=1,
n_informative=4,
n_redundant=2,
random_seed=42,
**kwargs,
)
Generate synthetic data stream using protree's RandomTree generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_windows
|
Number of windows to generate. |
100
|
|
window_length
|
Number of samples per window. |
1000
|
|
drift_positions
|
List of sample positions where drifts occur, or comma-separated string. |
None
|
|
drift_duration
|
Duration of drift transition in samples. |
1
|
|
n_informative
|
Number of informative features. |
4
|
|
n_redundant
|
Number of redundant features. |
2
|
|
random_seed
|
Random seed for reproducibility. |
42
|
|
**kwargs
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
|
Tuple of |
Source code in src/stride/datasets/random_tree_multi_window.py
RbfMultiWindowDataset
Bases: BaseDataset
generate
generate(
num_windows=100,
window_length=1000,
drift_positions=None,
drift_duration=1,
n_informative=5,
n_centroids=11,
random_seed=42,
**kwargs,
)
Generate synthetic data stream using protree's Rbf generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_windows
|
Number of windows to generate. |
100
|
|
window_length
|
Number of samples per window. |
1000
|
|
drift_positions
|
List of sample positions where drifts occur, or comma-separated string. |
None
|
|
drift_duration
|
Duration of drift transition in samples. |
1
|
|
n_informative
|
Number of informative features. |
5
|
|
n_centroids
|
Number of centroids. |
11
|
|
random_seed
|
Random seed for reproducibility. |
42
|
|
**kwargs
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
|
Tuple of |
Source code in src/stride/datasets/rbf_multi_window.py
SeaDriftDataset
Bases: BaseDataset
generate
generate(
n_samples_before=1000,
n_samples_after=1000,
random_seed=42,
n_features=3,
drift_width=1,
**kwargs,
)
Generate synthetic data stream using River's SEA generator. Drifts from variant 0 to variant 3 at the drift point. The SEA generator has 3 features, and we use all of them.
Both concepts are generated with the same random_seed. For abrupt drift
the post-drift stream therefore starts from the same feature sequence: the
first n_samples_after samples after the drift have exactly the same
features as the first samples of the stream and only their labels differ.
This is intentional and isolates pure concept drift (identical inputs,
changed decision boundary). To compare two independent feature samples,
use windows of at most n_samples_before / 2 samples on each side of
the drift point.
Source code in src/stride/datasets/sea_drift.py
SeaMultiWindowDataset
Bases: BaseDataset
generate
generate(
num_windows=100,
window_length=1000,
drift_positions=None,
drift_duration=1,
random_seed=42,
**kwargs,
)
Generate synthetic data stream using protree's SEA generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_windows
|
Number of windows to generate. |
100
|
|
window_length
|
Number of samples per window. |
1000
|
|
drift_positions
|
List of sample positions where drifts occur, or comma-separated string. |
None
|
|
drift_duration
|
Duration of drift transition in samples. |
1
|
|
random_seed
|
Random seed for reproducibility. |
42
|
|
**kwargs
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
|
Tuple of |
Source code in src/stride/datasets/sea_multi_window.py
SemiSyntheticDriftDataset
SemiSyntheticDriftDataset(
name="semi_synthetic",
display_name=None,
X_a=None,
y_a=None,
X_b=None,
y_b=None,
match_strategy="exact",
manual_mapping=None,
align_distributions=False,
scaler_type="standard",
scaler_mode="joint",
schedule="gradual",
n_samples=None,
t_0=None,
drift_width=200,
period=500,
random_seed=42,
static_file_path=None,
target_column="target",
)
Bases: BaseDataset
Semi-synthetic concept drift dataset generated by splicing two empirical datasets.
Adheres strictly to the Shaker Protocol (Shaker & Hüllermeier, 2015), providing feature alignment, controlled drift schedules, ground-truth change-point annotations, and drifting feature diagnostics.
Initialize SemiSyntheticDriftDataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Unique dataset identifier. |
'semi_synthetic'
|
display_name
|
str | None
|
Human-readable display name. |
None
|
X_a
|
DataFrame | None
|
Feature matrix for concept A. |
None
|
y_a
|
Series | None
|
Target series for concept A. |
None
|
X_b
|
DataFrame | None
|
Feature matrix for concept B. |
None
|
y_b
|
Series | None
|
Target series for concept B. |
None
|
match_strategy
|
str
|
Feature matching strategy ("exact", "manual", "statistical", or "subspace"). |
'exact'
|
manual_mapping
|
dict[str, str] | None
|
Manual column mapping dict for "manual" strategy. |
None
|
align_distributions
|
bool
|
Whether to normalize feature distributions. |
False
|
scaler_type
|
str | None
|
Scaler type ("standard" or "minmax"). |
'standard'
|
scaler_mode
|
str
|
Normalization mode ("joint" or "per_concept"). |
'joint'
|
schedule
|
str
|
Drift schedule ("abrupt", "gradual", "incremental", or "recurring"). |
'gradual'
|
n_samples
|
int | None
|
Total stream length in samples. |
None
|
t_0
|
int | None
|
Drift inflection point / midpoint. |
None
|
drift_width
|
int
|
Transition window width. |
200
|
period
|
int
|
Period T for recurring drift. |
500
|
random_seed
|
int
|
Random seed for reproducibility. |
42
|
static_file_path
|
str | None
|
Path to static pre-generated CSV if loading from persistent cache. |
None
|
target_column
|
str
|
Target column name if loading from static CSV. |
'target'
|
Source code in src/stride/datasets/semi_synthetic.py
concept_stream
property
Stream array tracking the true generative source concept (0 for A, 1 for B).
drift_diagnostics
property
Full statistical diagnostics table for all aligned features.
drift_intervals
property
Interval ranges [start, end] of concept transition regions.
drifting_features
property
Features with significant distribution drift between concepts.
feature_mapping
property
Mapping dictionary between Concept A and Concept B features.
ground_truth_drift_points
property
Timestamps of ground-truth drift midpoints / inflection points.
from_registry_info
classmethod
Instantiate SemiSyntheticDriftDataset from DatasetRegistry configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Dataset name. |
required |
registry_info
|
dict
|
Registry metadata dictionary. |
required |
registry
|
Any
|
DatasetRegistry instance. |
required |
Returns:
| Type | Description |
|---|---|
SemiSyntheticDriftDataset
|
Configured dataset instance. |
Source code in src/stride/datasets/semi_synthetic.py
generate
Generate or load the semi-synthetic concept drift stream.
Returns:
| Type | Description |
|---|---|
tuple[DataFrame, Series]
|
Tuple of |
Raises:
| Type | Description |
|---|---|
ValueError
|
If source concepts are not provided and static file is missing. |
Source code in src/stride/datasets/semi_synthetic.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
get_params
Return parameters for the semi-synthetic dataset.
Source code in src/stride/datasets/semi_synthetic.py
SineMultiWindowDataset
Bases: BaseDataset
generate
generate(
num_windows=100,
window_length=1000,
drift_positions=None,
drift_duration=1,
informative_attr_0=3,
informative_attr_1=2,
random_seed=42,
**kwargs,
)
Generate synthetic data stream using protree's Sine generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_windows
|
Number of windows to generate. |
100
|
|
window_length
|
Number of samples per window. |
1000
|
|
drift_positions
|
List of sample positions where drifts occur, or comma-separated string. |
None
|
|
drift_duration
|
Duration of drift transition in samples. |
1
|
|
informative_attr_0
|
First informative attribute. |
3
|
|
informative_attr_1
|
Second informative attribute. |
2
|
|
random_seed
|
Random seed for reproducibility. |
42
|
|
**kwargs
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
|
Tuple of |
Source code in src/stride/datasets/sine_multi_window.py
StaggerMultiWindowDataset
Bases: BaseDataset
generate
generate(
num_windows=100,
window_length=1000,
drift_positions=None,
drift_duration=1,
classification_function=0,
random_seed=42,
**kwargs,
)
Generate synthetic data stream using protree's Stagger generator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num_windows
|
Number of windows to generate. |
100
|
|
window_length
|
Number of samples per window. |
1000
|
|
drift_positions
|
List of sample positions where drifts occur, or comma-separated string. |
None
|
|
drift_duration
|
Duration of drift transition in samples. |
1
|
|
classification_function
|
Classification function (0, 1, or 2). |
0
|
|
random_seed
|
Random seed for reproducibility. |
42
|
|
**kwargs
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
|
Tuple of |
Source code in src/stride/datasets/stagger_multi_window.py
get_sample_wine_quality_data
Generate sample empirical subsets of Red and White wine quality data.
Preserves authentic empirical means and standard deviations, reproducing the canonical Shaker & Hüllermeier (2015) non-stationary benchmark with significant physicochemical drift in total sulfur dioxide, volatile acidity, and chlorides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_samples
|
int
|
Number of samples per wine concept. |
150
|
random_state
|
int
|
Seed for reproducibility. |
42
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[DataFrame, Series], tuple[DataFrame, Series]]
|
Tuple of |