Repository navigation
Data Pipeline
Collect · Validate · Transform · Batch · Train
A technical guide to EveryO's dataset abstractions, preprocessing utilities, data splitting, batching, CSV integration, and reproducible machine learning data workflows.
Home · Getting Started · Model Training · API Reference
Maintained By & Owner: EveryO Contributors & @krishanth7
Important
API Compatibility
This guide is based on the EveryO data package source from the repository's default branch.
The examples use public dataset and preprocessing APIs. Runtime results should be verified with the installed release.
EveryO's CSV reader is designed for numeric tables; complex CSV parsing and categorical encoding may require preprocessing outside the built-in loader.
- Overview
- Data Pipeline Architecture
- Data Module API
- Dataset Interface
- ArrayDataset
- Custom Datasets
- TransformDataset
- Subset
- DataLoader
- Batching and Shuffling
- CSV Dataset Loading
- Data Splitting
- StandardScaler
- MinMaxScaler
- Normalization and Encoding
- Data Quality and Validation
- Preventing Data Leakage
- Complete Data Pipeline Example
- Training Integration
- Performance and Memory
- Testing and Reproducibility
- Troubleshooting
- Developer References
- Next Steps
A data pipeline transforms raw information into structured batches suitable for machine learning.
EveryO provides dataset abstractions, preprocessing functions, data splitting, and mini-batch iteration.
- Organize features and targets.
- Validate dataset shapes.
- Apply transformations.
- Split datasets.
- Standardize or normalize features.
- Encode categorical targets.
- Construct mini-batches.
- Shuffle training samples.
- Supply data to the training engine.
| Component | Responsibility |
|---|---|
Dataset |
Base dataset interface |
ArrayDataset |
NumPy-backed dataset |
TransformDataset |
Apply sample transformations |
Subset |
Select dataset samples |
DataLoader |
Mini-batch iteration |
StandardScaler |
Feature standardization |
MinMaxScaler |
Feature scaling |
load_csv_dataset |
Numeric CSV loading |
RAW DATA
|
v
Data Validation
|
v
Data Splitting
|
v
Feature Processing
|
v
Dataset Objects
|
v
DataLoader
|
v
Mini-Batches
|
v
EveryO Trainer
|
v
Model Output
A reliable pipeline should be:
- Deterministic where required.
- Easy to test.
- Consistent across training and inference.
- Resistant to data leakage.
- Clear about feature shapes.
- Efficient for the intended dataset size.
EveryO's everyo.data package exports:
| API | Purpose |
|---|---|
Dataset |
Abstract dataset |
ArrayDataset |
Array-backed dataset |
TransformDataset |
Transformation wrapper |
Subset |
Indexed subset |
DataLoader |
Mini-batch loader |
default_collate |
Combine samples into batches |
load_csv_dataset |
Numeric CSV reader |
train_test_split |
Training/test splitting |
random_split |
Random dataset splitting |
stratified_split |
Class-aware splitting |
StandardScaler |
Standardization |
MinMaxScaler |
Range scaling |
standardize |
Standardization function |
min_max_scale |
Min-max scaling function |
normalize |
Unit-norm normalization |
one_hot_encode |
One-hot label encoding |
shuffle_arrays |
Shared array shuffling |
import everyo as eoOr import directly from the data package:
from everyo.data import (
ArrayDataset,
DataLoader,
StandardScaler,
MinMaxScaler,
)The Dataset class defines the core dataset contract.
__len__()
__getitem__(index)__len__() returns the number of samples.
__getitem__() returns a sample or a feature-target pair.
Dataset
|
+-- __len__()
|
+-- __getitem__(index)
|
+-- __iter__()
For supervised learning:
(features, target)For feature-only datasets:
featuresArrayDataset stores features and optional targets in NumPy-backed arrays.
ArrayDataset(features, targets=None)import numpy as np
import everyo as eo
features = np.array([
[1.0, 2.0],
[3.0, 4.0],
[5.0, 6.0],
], dtype=np.float32)
targets = np.array(
[0, 1, 0],
dtype=np.int64
)
dataset = eo.ArrayDataset(
features,
targets
)
print("Samples:", len(dataset))
print("Feature shape:", dataset.feature_shape)
print("First sample:", dataset[0])Samples: 3
Feature shape: (2,)
The implementation checks:
- Features must have at least one dimension.
- Features and targets must contain equal sample counts.
- Unsupported object-type arrays are rejected.
dataset = eo.ArrayDataset(features)
sample = dataset[0]This is useful for inference or unsupervised workflows.
Developers can implement custom dataset classes using the base contract.
import numpy as np
import everyo as eo
class CustomDataset(eo.Dataset):
def __init__(self):
self.features = np.array([
[1.0, 2.0],
[3.0, 4.0]
], dtype=np.float32)
self.targets = np.array(
[0, 1],
dtype=np.int64
)
def __len__(self):
return len(self.features)
def __getitem__(self, index):
return (
self.features[index],
self.targets[index]
)
dataset = CustomDataset()
print(len(dataset))- Return consistent sample structures.
- Validate indices where appropriate.
- Avoid unnecessary data copying.
- Document target encoding.
- Ensure the loader can stack samples.
TransformDataset applies transformations to dataset samples.
TransformDataset(
dataset,
transform=None,
target_transform=None
)import numpy as np
import everyo as eo
base_dataset = eo.ArrayDataset(
np.array([
[1.0, 2.0],
[3.0, 4.0]
], dtype=np.float32),
np.array([0, 1])
)
transformed = eo.TransformDataset(
base_dataset,
transform=lambda x: x * 2.0
)
print(transformed[0])The first feature sample becomes:
[2. 4.]
- Feature transformations.
- Data augmentation.
- Input normalization using fitted statistics.
- Target transformations.
Transformations should not unintentionally change sample shapes in ways that prevent batching.
Subset creates an indexed view of another dataset.
Subset(dataset, indices)import everyo as eo
dataset = eo.ArrayDataset(
[[1.0], [2.0], [3.0], [4.0]],
[0, 1, 0, 1]
)
subset = eo.Subset(
dataset,
indices=[0, 2]
)
print("Subset size:", len(subset))Expected output:
Subset size: 2
Subset indices must refer to valid samples in the underlying dataset.
- Training subsets.
- Validation subsets.
- Controlled experiments.
- Debugging smaller datasets.
The DataLoader class provides mini-batch iteration.
DataLoader(
dataset,
batch_size=32,
*,
shuffle=False,
drop_last=False,
seed=None
)| Parameter | Description |
|---|---|
dataset |
Dataset to iterate |
batch_size |
Samples per batch |
shuffle |
Shuffle each epoch |
drop_last |
Drop incomplete final batch |
seed |
Optional shuffling seed |
import numpy as np
import everyo as eo
features = np.arange(
40,
dtype=np.float32
).reshape(20, 2)
targets = np.arange(20)
dataset = eo.ArrayDataset(
features,
targets
)
loader = eo.DataLoader(
dataset,
batch_size=5,
shuffle=True,
seed=42
)
for batch_x, batch_y in loader:
print(batch_x.shape, batch_y.shape)Each full batch has shapes:
(5, 2) (5,)
print(len(loader))
print(loader.num_samples)For 20 samples with batch size 5:
4
20
When incomplete batches are retained:
[ N_{batches}= \left\lceil \frac{N}{B} \right\rceil ]
When incomplete batches are dropped:
[ N_{batches}= \left\lfloor \frac{N}{B} \right\rfloor ]
where:
- (N) = number of samples.
- (B) = batch size.
For 103 samples and batch size 16:
Without dropping the final batch:
[ \lceil103/16\rceil=7 ]
With drop_last=True:
[ \lfloor103/16\rfloor=6 ]
loader = eo.DataLoader(
dataset,
batch_size=16,
shuffle=True,
seed=42
)The inspected implementation uses a NumPy random generator and reshuffles the order at the start of each iteration when shuffle=True.
- Shuffle training data when appropriate.
- Avoid inappropriate shuffling of temporal sequences.
- Preserve feature-target alignment.
- Record seeds for reproducibility.
EveryO includes a numeric CSV reader.
load_csv_dataset(
path,
*,
target_column=-1,
delimiter=",",
has_header=None,
skip_columns=()
)| Parameter | Description |
|---|---|
path |
CSV file location |
target_column |
Target index, header name, or None
|
delimiter |
Column separator |
has_header |
Header handling |
skip_columns |
Columns to exclude by index |
temperature,humidity,pressure,target
28.5,70,1012,1
29.0,68,1010,0
27.8,75,1013,1import everyo as eo
dataset = eo.load_csv_dataset(
"data.csv",
target_column="target",
has_header=True
)
print(len(dataset))
print(dataset.feature_shape)The reader expects numeric data columns.
Non-numeric categories must be encoded before loading.
Complex CSV files containing quoted delimiters or multiline fields may require a more capable CSV preprocessing step.
Splitting separates model fitting from evaluation.
train_test_splitrandom_splitstratified_split
| Dataset | Example Share |
|---|---|
| Training | 70% |
| Validation | 15% |
| Testing | 15% |
These are illustrative proportions, not mandatory defaults.
Use random splitting when samples are sufficiently independent.
Use stratification when class proportions should be preserved.
Use chronological splitting for time-dependent prediction tasks.
Use group-aware splitting when related samples must not appear in multiple partitions.
import inspect
import everyo as eo
for name in [
"train_test_split",
"random_split",
"stratified_split"
]:
print(
name,
inspect.signature(getattr(eo, name))
)StandardScaler standardizes features using training-data statistics.
[ z=\frac{x-\mu}{\sigma} ]
where:
- (x) = input value.
- (\mu) = feature mean.
- (\sigma) = feature standard deviation.
The implementation uses a small positive denominator floor for numerical stability.
import numpy as np
import everyo as eo
train_x = np.array([
[10.0, 100.0],
[20.0, 200.0],
[30.0, 300.0]
], dtype=np.float32)
scaler = eo.StandardScaler()
scaled_train = scaler.fit_transform(
train_x
)
print(scaled_train)new_x = np.array([
[25.0, 250.0]
], dtype=np.float32)
scaled_new = scaler.transform(new_x)| Method | Purpose |
|---|---|
fit() |
Learn feature statistics |
transform() |
Apply scaling |
fit_transform() |
Fit and transform |
inverse_transform() |
Reverse scaling |
Fit the scaler only on training data.
Use the fitted scaler to transform validation, test, and inference data.
MinMaxScaler maps features into a configured numerical range.
For the default range [0, 1]:
[ x'=\frac{x-x_{min}}{x_{max}-x_{min}} ]
The implementation protects against zero feature spans.
MinMaxScaler(
feature_range=(0.0, 1.0)
)import numpy as np
import everyo as eo
features = np.array([
[10.0],
[20.0],
[30.0]
], dtype=np.float32)
scaler = eo.MinMaxScaler()
scaled = scaler.fit_transform(features)
print(scaled)Expected values:
[[0. ]
[0.5]
[1. ]]
scaler = eo.MinMaxScaler(
feature_range=(-1.0, 1.0)
)New values outside the fitted training range can transform to values outside the configured range.
The inspected transform() implementation does not automatically clip such results.
EveryO provides additional preprocessing functions.
import numpy as np
import everyo as eo
features = np.array([
[3.0, 4.0],
[5.0, 12.0]
])
normalized = eo.normalize(features)
print(normalized)The default normalization uses the L2 norm along axis 1.
For vector (x):
[ x'=\frac{x}{|x|_2} ]
with a denominator safeguard for zero norms.
import everyo as eo
labels = [0, 2, 1]
encoded = eo.one_hot_encode(
labels,
num_classes=3
)
print(encoded)Expected output:
[[1. 0. 0.]
[0. 0. 1.]
[0. 1. 0.]]
scaled = eo.standardize(features)scaled = eo.min_max_scale(features)shuffled_x, shuffled_y = eo.shuffle_arrays(
features,
labels,
seed=42
)Shared shuffling preserves sample alignment.
Machine learning pipelines should validate data before training.
- Sample count.
- Feature count.
- Target alignment.
- Missing values.
- Infinite values.
- Duplicate records.
- Invalid labels.
- Outliers.
- Data type compatibility.
- Class distribution.
import numpy as np
def validate_features(features):
array = np.asarray(features)
if array.ndim != 2:
raise ValueError(
"Expected a 2D feature matrix."
)
if not np.isfinite(array).all():
raise ValueError(
"Features contain NaN or infinity."
)
return array
validated = validate_features(train_x)- Feature dimensions verified.
- Targets aligned.
- Missing values handled.
- Invalid numeric values removed or corrected.
- Class labels validated.
- Data split completed.
- Training-only preprocessing fitted.
- Validation data kept separate.
Data leakage occurs when information unavailable during real prediction influences training.
- Fitting scalers on the entire dataset.
- Duplicate samples across partitions.
- Using future information.
- Encoding target-derived information into features.
- Selecting features using test-set results.
Entire Dataset
|
v
Fit StandardScaler
|
v
Split Data
This allows validation/test statistics to influence training preprocessing.
Entire Dataset
|
v
Split Data
|
+----------------+
| |
v v
Training Data Validation Data
| |
v |
Fit StandardScaler |
| |
v v
Transform Train Transform Validation
| |
+----------------+
|
v
Model Training
Keep all preprocessing statistics derived exclusively from the training partition unless the methodology explicitly requires otherwise.
This example combines data generation, splitting, preprocessing, dataset construction, and batching.
import numpy as np
import everyo as eo
# ---------------------------------
# 1. Generate synthetic data
# ---------------------------------
rng = np.random.default_rng(42)
features = rng.normal(
size=(200, 4)
).astype(np.float32)
targets = (
features[:, 0] + features[:, 1] > 0
).astype(np.int64)
# ---------------------------------
# 2. Shuffle consistently
# ---------------------------------
order = rng.permutation(len(features))
features = features[order]
targets = targets[order]
# ---------------------------------
# 3. Split data
# ---------------------------------
train_x = features[:160]
train_y = targets[:160]
val_x = features[160:]
val_y = targets[160:]
# ---------------------------------
# 4. Fit preprocessing
# ---------------------------------
scaler = eo.StandardScaler()
train_x = scaler.fit_transform(train_x)
val_x = scaler.transform(val_x)
# ---------------------------------
# 5. Create datasets
# ---------------------------------
train_dataset = eo.ArrayDataset(
train_x,
train_y
)
val_dataset = eo.ArrayDataset(
val_x,
val_y
)
# ---------------------------------
# 6. Create data loaders
# ---------------------------------
train_loader = eo.DataLoader(
train_dataset,
batch_size=16,
shuffle=True,
seed=42
)
val_loader = eo.DataLoader(
val_dataset,
batch_size=16,
shuffle=False
)
# ---------------------------------
# 7. Validate output
# ---------------------------------
print("Training samples:", len(train_dataset))
print("Validation samples:", len(val_dataset))
print("Training batches:", len(train_loader))
print("Validation batches:", len(val_loader))
for batch_x, batch_y in train_loader:
print("Batch X:", batch_x.shape)
print("Batch Y:", batch_y.shape)
break| Output | Expected |
|---|---|
| Training samples | 160 |
| Validation samples | 40 |
| Training batches | 10 |
| Validation batches | 3 |
| First training feature batch | (16, 4) |
| First training target batch | (16,) |
Synthetic Data
|
v
Consistent Shuffle
|
v
Training / Validation Split
|
v
Training-Only StandardScaler Fit
|
v
ArrayDataset
|
v
DataLoader
|
v
Training-Ready Batches
DataLoaders integrate with EveryO's Trainer.
import everyo as eo
model = eo.Sequential(
eo.Linear(4, 8, seed=0),
eo.ReLU(),
eo.Linear(8, 2, seed=1)
)
optimizer = eo.Adam(
model.parameters(),
lr=0.01
)
trainer = eo.Trainer(
model,
optimizer,
eo.CrossEntropyLoss(),
metrics=["accuracy"]
)
history = trainer.fit(
train_loader,
epochs=20,
validation_loader=val_loader,
verbose=False
)
print(history.last())For supervised training, each batch should provide:
(features, targets)Confirm that:
- Input shapes match the model.
- Target encoding matches the loss.
- Features are finite.
- Training and validation partitions are separate.
- Batch sizes are appropriate.
Related: Model Training
Data pipelines affect training throughput and memory consumption.
- Dataset size.
- Batch size.
- Array layout.
- Preprocessing cost.
- Data copying.
- Transformation complexity.
- Memory capacity.
The inspected DataLoader implementation uses a direct array-indexing path for ArrayDataset.
For other dataset types, it uses sample-by-sample collection and default_collate.
For dense features:
[ M=N\times F\times B ]
where:
- (N) = samples.
- (F) = features per sample.
- (B) = bytes per element.
For 100,000 samples with 20 float32 features:
[ M=100000\times20\times4 ]
[ M=8{,}000{,}000\text{ bytes} ]
Approximately 7.63 MiB for the raw feature array, excluding targets and processing overhead.
- Avoid unnecessary copies.
- Prefer appropriate numerical dtypes.
- Profile preprocessing.
- Select batch size experimentally.
- Validate memory usage.
- Avoid expensive transformations inside repeated sample access when they can be precomputed safely.
python -m pytest- Dataset length.
- Feature-target alignment.
- Index validation.
- Batch count.
- Shuffling behavior.
- Scaling correctness.
- Missing-value detection.
- CSV parsing.
- Reproducible random seeds.
- Data leakage prevention.
assert len(train_dataset) == 160
assert len(val_dataset) == 40
assert train_dataset.feature_shape == (4,)
assert len(train_loader) == 10
assert len(val_loader) == 3Record:
- Dataset version.
- Split strategy.
- Random seed.
- Preprocessing configuration.
- EveryO version.
- Python version.
- Dependency versions.
Feature and target counts differ
Confirm that both arrays contain the same number of samples in their first dimension.
StandardScaler raises an error
Call fit() or fit_transform() on training data before transform().
Confirm feature dimensions match those used during fitting.
CSV loading fails
Verify the file path, delimiter, header configuration, target column, and numeric values.
Encode categorical columns before loading.
DataLoader returns unexpected batch shapes
Inspect the shape of individual dataset samples and verify that they can be stacked consistently.
Training and validation results differ significantly
Investigate preprocessing consistency, class distributions, leakage, overfitting, and dataset shift.
DataLoader produces fewer batches than expected
Check batch_size and drop_last.
| Resource | Link |
|---|---|
| EveryO Repository | GitHub |
| Data Package | everyo/data/ |
| Dataset Implementation | dataset.py |
| DataLoader Implementation | dataloader.py |
| Preprocessing Implementation | preprocessing.py |
| Data Splitting | split.py |
| Training Engine | trainer.py |
| Tests | tests/ |
| Issues | GitHub Issues |
Continue with the following EveryO Wiki pages.
| Page | Focus |
|---|---|
| Model Serialization | Saving, loading, and checkpoints |
| Performance Optimization | Profiling and benchmarking |
| Model Training | Training pipelines |
| Examples and Tutorials | Practical development |
| API Reference | Public interfaces |
Wiki links become active after their corresponding pages are created.
Next Recommended Page: Model Serialization →
Home · Model Training · Examples and Tutorials · API Reference
EveryO — Open Machine Learning. Built for Developers.
Maintained By & Owner:
EveryO Contributors & @krishanth7
Open Source · MIT Licensed · Community Driven
© 2026 EveryO Contributors