Pipelines
This section covers advanced pipeline patterns and techniques.
Overview
NIRS4ALL pipelines are flexible and powerful. This section covers advanced patterns beyond basic sequential pipelines.
✍️ Writing Pipelines
Complete guide to pipeline syntax and patterns.
🌿 Branching & Merging
Create parallel paths with different preprocessing strategies.
📚 Stacking
Build meta-models that combine predictions from multiple base models.
👥 Group Splitting
Ensure related samples stay together during cross-validation.
🔀 Multi-Source Pipelines
Handle multiple data sources with source_branch and merge_sources.
Pipeline Patterns
Sequential Pipeline
pipeline = [
MinMaxScaler(),
SNV(),
KFold(n_splits=5),
{"model": PLSRegression(10)}
]
Branching Pipeline
pipeline = [
{"branch": [
[SNV(), PLSRegression(10)],
[MSC(), RandomForestRegressor()]
]},
{"merge": "predictions"} # Combine for stacking
]
Generator Pipeline
pipeline = [
{"_or_": [SNV, MSC, Detrend]}, # Try each preprocessing
{"_range_": [1, 20, 2], "model": PLSRegression} # Sweep n_components
]
See Also
Writing a Pipeline in nirs4all - Complete syntax reference
Generator Keywords Reference - Generator syntax (
_or_,_range_)Operator Catalog - All available operators