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.
Complete guide to pipeline syntax and patterns.
Create parallel paths with different preprocessing strategies.
Combine branch outputs: features, predictions, or both for stacking.
Build meta-models that combine predictions from multiple base models.
Handle multiple data sources with source_branch and merge_sources.
Speed up generator-heavy pipelines with step-level caching.
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: choices, combinations and their exact outputs - Generator syntax (
_or_,_range_)Operator catalog: choose a job, then inspect the method - All available operators