ML Pipeline
Unified skill for the complete ML pipeline within a quant trading research system.
Consolidates eight prior skills into a single authoritative reference covering
the full lifecycle: data validation, feature creation, selection,
transformation, anti-leakage checks, pipeline automation, deep learning optimization, and deployment.
1. When to Use
Activate this skill when the task involves any of the following:
- Creating, selecting, or transforming features for an ML-driven strategy.
- Auditing an existing feature pipeline for data leakage or overfitting risk.
- Automating an end-to-end ML pipeline (data prep through model export).
- Evaluating feature importance, scaling, encoding, or interaction effects.
- Integrating features with a feature store (Feast, Tecton, custom Parquet store).
- Explaining core ML concepts (bias-variance, cross-validation, regularisation)
in the context of feature engineering decisions.
2. Inputs to Gather
Before starting work, collect or confirm:
| Input |
Details |
| Objective |
Target metric (Sharpe, accuracy, RMSE ...), constraints, time horizon. |
| Data |
Symbols / instruments, timeframe, bar type, sampling frequency, data sources. |
| Leakage risks |
Point-in-time concerns, survivorship bias, look-ahead in labels or features. |
| Compute budget |
CPU/GPU limits, wall-clock budget for AutoML search. |
| Latency |
Online vs. offline inference, acceptable prediction latency. |
| Interpretability |
Regulatory or research need for explainable features / models. |
| Deployment target |
Where the model will run (notebook, backtest harness, live engine). |
3. Feature Creation Patterns
3.1 Numerical Features
- Interaction terms:
price * volume, high / low, close - open.
- Rolling statistics: mean, std, skew, kurtosis over configurable windows.
- Polynomial / log transforms:
log(volume + 1), spread^2.
- Binning / discretisation: equal-width, quantile-based, or domain-driven bins.
3.2 Categorical Features
- One-hot encoding: for low-cardinality categoricals (sector, exchange).
- Target encoding: mean-target per category with smoothing (careful of leakage -- use only in-fold means).
- Ordinal encoding: when categories have a natural order (credit rating).
3.3 Time-Series Specific
- Lag features:
return_{t-1}, return_{t-5}, etc.
- Calendar features: day-of-week, month, quarter, options-expiry flag.
- Rolling z-score:
(x - rolling_mean) / rolling_std for stationarity.
- Fractional differentiation: preserve memory while achieving stationarity (Lopez de Prado).
3.4 Feature Selection Techniques
- Filter methods: mutual information, variance threshold, correlation pruning.
- Wrapper methods: recursive feature elimination (RFE), forward/backward selection.
- Embedded methods: L1 regularisation, tree-based importance, SHAP values.
- Permutation importance: model-agnostic; run on out-of-fold predictions.
4. Anti-Leakage Checks
Data leakage is the single most common cause of inflated backtest results.
Apply these checks at every pipeline stage:
4.1 Label Leakage
- Labels must be computed from future returns relative to the feature
timestamp. Verify that the label window does not overlap the feature window.
- Use purging and embargo when labels span multiple bars.
4.2 Feature Leakage
- No feature may use information from time
t+1 or later at prediction time t.
- Rolling statistics must use a closed left window:
df['feat'].rolling(20).mean().shift(1).
- Target-encoded categoricals must be computed on the training fold only.
4.3 Cross-Validation Leakage
- Use purged k-fold or walk-forward CV for time-series. Never use random
k-fold on ordered data.
- Insert an embargo gap between train and test folds to prevent bleed-through
from autocorrelation.
4.4 Survivorship & Selection Bias
- Ensure the universe of instruments at time
t reflects what was actually
tradable at that time (delisted stocks, halted symbols removed later).
- Backfill from point-in-time databases where available.
4.5 Validation Checklist
Run before every backtest:
[ ] Labels computed strictly from future returns (no overlap with features)
[ ] All rolling features shifted by at least 1 bar
[ ] Target encoding uses in-fold means only
[ ] Walk-forward or purged CV used (no random shuffle on time-series)
[ ] Embargo gap >= max(label_horizon, autocorrelation_lag)
[ ] Universe is point-in-time (no survivorship bias)
[ ] No global scaling fitted on full dataset (fit on train, transform test)
5. Pipeline Automation (AutoML)
5.1 Prerequisites
- Python environment with one or more AutoML libraries:
Auto-sklearn, TPOT, H2O AutoML, PyCaret, Optuna, or custom Optuna pipelines.
- Training data in CSV / Parquet / database.
- Problem type identified: classification, regression, or time-series forecasting.
5.2 Pipeline Steps
| Step |
Action |
| 1. Define requirements |
Problem type, evaluation metric, time/resource budget, interpretability needs. |
| 2. Data infrastructure |
Load data, quality assessment, train/val/test split strategy, define feature transforms. |
| 3. Configure AutoML |
Select framework, define algorithm search space, set preprocessing steps, choose tuning strategy (Bayesian, random, Hyperband). |
| 4. Execute training |
Run automated feature engineering, model selection, hyperparameter optimisation, cross-validation. |
| 5. Analyse & export |
Compare models, extract best config, feature importance, visualisations, export for deployment. |
5.3 Pipeline Configuration Template
pipeline_config = {
"task_type": "classification", # or "regression", "time_series"
"time_budget_seconds": 3600,
"algorithms": ["rf", "xgboost", "catboost", "lightgbm"],
"preprocessing": ["scaling", "encoding", "imputation"],
"tuning_strategy": "bayesian", # or "random", "hyperband"
"cv_folds": 5,
"cv_type": "purged_kfold", # or "walk_forward"
"embargo_bars": 10,
"early_stopping_rounds": 50,
"metric": "sharpe_ratio", # domain-specific metric
}
5.4 Output Artifacts
automl_config.py -- pipeline configuration.
best_model.pkl / .joblib / .onnx -- serialised model.
feature_pipeline.pkl -- fitted preprocessing + feature transforms.
evaluation_report.json -- metrics, confusion matrix / residuals, feature rankings.
deployment/ -- prediction API code, input validation, requirements.txt.
6. Core ML Fundamentals (Feature-Engineering Context)
6.1 Bias-Variance Trade-off
- More features increase model capacity (lower bias) but risk overfitting (higher variance).
- Use regularisation (L1/L2), feature selection, or dimensionality reduction to manage.
6.2 Evaluation Strategy
- Walk-forward validation: the gold standard for time-series strategies.
Roll a fixed-width training window forward; test on the next out-of-sample period.
- Monte Carlo permutation tests: shuffle labels and re-evaluate to estimate
the probability that observed performance is due to chance.
- Combinatorial purged CV (CPCV): generate many train/test combinations with
purging for more robust performance estimates.
6.3 Feature Scaling
- Fit scalers (StandardScaler, MinMaxScaler, RobustScaler) on the training set only.
- Apply the same fitted scaler to validation and test sets.
- RobustScaler is often preferred for financial data due to heavy tails.
6.4 Handling Missing Data
- Forward-fill then backward-fill for price data (be aware of leakage on backfill).
- Indicator column for missingness can itself be informative.
- Tree-based models can handle NaN natively; linear models cannot.
7. Workflow
For any feature engineering task, follow this sequence:
- Restate the task in measurable terms (metric, constraints, deadline).
- Enumerate required artifacts: datasets, feature definitions, configs, scripts, reports.
- Propose a default approach and 1-2 alternatives with trade-offs.
- Implement feature pipeline with anti-leakage checks built in.
- Validate with walk-forward CV, Monte Carlo, and the leakage checklist above.
- Deliver repo-ready code, documentation, and a run command.
8. Deep Learning Optimization
8.1 Optimizer Selection
| Optimizer |
Best For |
Learning Rate |
| Adam |
Most cases, adaptive |
1e-3 to 1e-4 |
| AdamW |
Transformers, weight decay |
1e-4 to 1e-5 |
| SGD + Momentum |
Large batches, fine-tuning |
1e-2 to 1e-3 |
| RAdam |
Stability without warmup |
1e-3 |
8.2 Learning Rate Scheduling
- OneCycleLR: Best for short training, fast convergence
- CosineAnnealing: Smooth decay, good generalization
- ReduceOnPlateau: Adaptive when validation loss plateaus
- Warmup + Decay: Standard for transformers
8.3 Regularization Techniques
- Dropout: 0.1-0.5 for fully connected layers
- L2 (Weight Decay): 1e-4 to 1e-2
- Batch Normalization: Stabilizes training
- Early Stopping: Monitor validation loss, patience 5-10 epochs
8.4 PyTorch Lightning Integration
import pytorch_lightning as pl
class TradingModel(pl.LightningModule):
def configure_optimizers(self):
optimizer = torch.optim.AdamW(self.parameters(), lr=1e-4)
scheduler = torch.optim.lr_scheduler.OneCycleLR(
optimizer, max_lr=1e-3, total_steps=self.trainer.estimated_stepping_batches
)
return [optimizer], [scheduler]
8.5 Financial Reinforcement Learning
- State: Market features, portfolio state, position
- Action: Buy/Sell/Hold, position sizing
- Reward: Risk-adjusted returns (Sharpe, Sortino)
- Frameworks: Stable-Baselines3, RLlib, FinRL
9. Error Handling
| Problem |
Cause |
Fix |
| AutoML search finds no good model |
Insufficient time budget or poor features |
Increase budget, engineer better features, expand algorithm search space. |
| Out of memory during training |
Dataset too large for available RAM |
Downsample, use incremental learning, simplify feature engineering. |
| Model accuracy below threshold |
Weak signal or overfitting |
Collect more data, add domain-driven features, regularise, adjust metric. |
| Feature transforms produce NaN/Inf |
Division by zero, log of negative |
Add guards: np.where(denom != 0, ...), np.log1p(np.abs(x)). |
| Optimiser fails to converge |
Bad hyperparameter ranges |
Tighten search bounds, increase iterations, exclude unstable algorithms. |
10. Bundled Scripts
All scripts live in scripts/ within this skill directory.
| Script |
Purpose |
data_validation.py |
Validate input data quality before pipeline execution. |
model_evaluation.py |
Evaluate trained model performance and generate reports. |
pipeline_deployment.py |
Deploy a trained pipeline to a target environment with rollback support. |
feature_engineering_pipeline.py |
End-to-end feature engineering: load, clean, transform, select, train. |
feature_importance_analyzer.py |
Analyse feature importance (permutation, SHAP, tree-based). |
data_visualizer.py |
Visualise feature distributions and relationships to target. |
feature_store_integration.py |
Integrate with feature stores (Feast, Tecton) for online/offline serving. |
11. Resources
Frameworks
Key References
- Lopez de Prado, Advances in Financial Machine Learning (2018) -- purged CV, fractional differentiation, meta-labelling.
- Hastie, Tibshirani & Friedman, The Elements of Statistical Learning -- bias-variance, regularisation, model selection.
- scikit-learn user guide: feature extraction, preprocessing, model selection.
Best Practices
- Always start with a simple baseline before running AutoML.
- Balance automation with domain knowledge -- blind search rarely beats informed priors.
- Monitor resource consumption; set hard timeouts.
- Validate on true out-of-sample holdout data, not just cross-validation.
- Document every pipeline decision for reproducibility.
1---
2name: ml-pipeline
3description: >
4 Complete machine learning pipeline for trading: feature engineering, AutoML, deep learning, and financial RL.
5 Use for automated parameter sweeps, feature creation, model training, and anti-leakage validation.
6version: "2.0.0"
7allowed-tools: Read, Write, Edit, Bash, Glob, Grep
8metadata:
9 source: https://skillmd.com/skills/modbender/ml-pipeline
10 consolidates:
11 - ml-feature-engineering
12 - deep-learning-optimizer-5
13 - pytorch-lightning-2
14 - scikit-learn-ml-framework
15 - automl-pipeline-builder-2
16 - ml-feature-engineering-helper
17 - ml-fundamentals
18 - machine-learning-feature-engineering-toolkit
19---
20
21# ML Pipeline
22
23Unified skill for the complete ML pipeline within a quant trading research system.
24Consolidates eight prior skills into a single authoritative reference covering
25the full lifecycle: data validation, feature creation, selection,
26transformation, anti-leakage checks, pipeline automation, deep learning optimization, and deployment.
27
28---
29
30## 1. When to Use
31
32Activate this skill when the task involves any of the following:
33
34- Creating, selecting, or transforming features for an ML-driven strategy.
35- Auditing an existing feature pipeline for data leakage or overfitting risk.
36- Automating an end-to-end ML pipeline (data prep through model export).
37- Evaluating feature importance, scaling, encoding, or interaction effects.
38- Integrating features with a feature store (Feast, Tecton, custom Parquet store).
39- Explaining core ML concepts (bias-variance, cross-validation, regularisation)
40 in the context of feature engineering decisions.
41
42---
43
44## 2. Inputs to Gather
45
46Before starting work, collect or confirm:
47
48| Input | Details |
49|-------|---------|
50| **Objective** | Target metric (Sharpe, accuracy, RMSE ...), constraints, time horizon. |
51| **Data** | Symbols / instruments, timeframe, bar type, sampling frequency, data sources. |
52| **Leakage risks** | Point-in-time concerns, survivorship bias, look-ahead in labels or features. |
53| **Compute budget** | CPU/GPU limits, wall-clock budget for AutoML search. |
54| **Latency** | Online vs. offline inference, acceptable prediction latency. |
55| **Interpretability** | Regulatory or research need for explainable features / models. |
56| **Deployment target** | Where the model will run (notebook, backtest harness, live engine). |
57
58---
59
60## 3. Feature Creation Patterns
61
62### 3.1 Numerical Features
63
64- **Interaction terms**: `price * volume`, `high / low`, `close - open`.
65- **Rolling statistics**: mean, std, skew, kurtosis over configurable windows.
66- **Polynomial / log transforms**: `log(volume + 1)`, `spread^2`.
67- **Binning / discretisation**: equal-width, quantile-based, or domain-driven bins.
68
69### 3.2 Categorical Features
70
71- **One-hot encoding**: for low-cardinality categoricals (sector, exchange).
72- **Target encoding**: mean-target per category with smoothing (careful of leakage -- use only in-fold means).
73- **Ordinal encoding**: when categories have a natural order (credit rating).
74
75### 3.3 Time-Series Specific
76
77- **Lag features**: `return_{t-1}`, `return_{t-5}`, etc.
78- **Calendar features**: day-of-week, month, quarter, options-expiry flag.
79- **Rolling z-score**: `(x - rolling_mean) / rolling_std` for stationarity.
80- **Fractional differentiation**: preserve memory while achieving stationarity (Lopez de Prado).
81
82### 3.4 Feature Selection Techniques
83
84- **Filter methods**: mutual information, variance threshold, correlation pruning.
85- **Wrapper methods**: recursive feature elimination (RFE), forward/backward selection.
86- **Embedded methods**: L1 regularisation, tree-based importance, SHAP values.
87- **Permutation importance**: model-agnostic; run on out-of-fold predictions.
88
89---
90
91## 4. Anti-Leakage Checks
92
93Data leakage is the single most common cause of inflated backtest results.
94Apply these checks at every pipeline stage:
95
96### 4.1 Label Leakage
97
98- Labels must be computed from **future** returns relative to the feature
99 timestamp. Verify that the label window does not overlap the feature window.
100- Use purging and embargo when labels span multiple bars.
101
102### 4.2 Feature Leakage
103
104- No feature may use information from time `t+1` or later at prediction time `t`.
105- Rolling statistics must use a **closed** left window: `df['feat'].rolling(20).mean().shift(1)`.
106- Target-encoded categoricals must be computed on the **training fold only**.
107
108### 4.3 Cross-Validation Leakage
109
110- Use **purged k-fold** or **walk-forward** CV for time-series. Never use random
111 k-fold on ordered data.
112- Insert an **embargo gap** between train and test folds to prevent bleed-through
113 from autocorrelation.
114
115### 4.4 Survivorship & Selection Bias
116
117- Ensure the universe of instruments at time `t` reflects what was actually
118 tradable at that time (delisted stocks, halted symbols removed later).
119- Backfill from point-in-time databases where available.
120
121### 4.5 Validation Checklist
122
123Run before every backtest:
124
125```text
126[ ] Labels computed strictly from future returns (no overlap with features)
127[ ] All rolling features shifted by at least 1 bar
128[ ] Target encoding uses in-fold means only
129[ ] Walk-forward or purged CV used (no random shuffle on time-series)
130[ ] Embargo gap >= max(label_horizon, autocorrelation_lag)
131[ ] Universe is point-in-time (no survivorship bias)
132[ ] No global scaling fitted on full dataset (fit on train, transform test)
133```
134
135---
136
137## 5. Pipeline Automation (AutoML)
138
139### 5.1 Prerequisites
140
141- Python environment with one or more AutoML libraries:
142 Auto-sklearn, TPOT, H2O AutoML, PyCaret, Optuna, or custom Optuna pipelines.
143- Training data in CSV / Parquet / database.
144- Problem type identified: classification, regression, or time-series forecasting.
145
146### 5.2 Pipeline Steps
147
148| Step | Action |
149|------|--------|
150| **1. Define requirements** | Problem type, evaluation metric, time/resource budget, interpretability needs. |
151| **2. Data infrastructure** | Load data, quality assessment, train/val/test split strategy, define feature transforms. |
152| **3. Configure AutoML** | Select framework, define algorithm search space, set preprocessing steps, choose tuning strategy (Bayesian, random, Hyperband). |
153| **4. Execute training** | Run automated feature engineering, model selection, hyperparameter optimisation, cross-validation. |
154| **5. Analyse & export** | Compare models, extract best config, feature importance, visualisations, export for deployment. |
155
156### 5.3 Pipeline Configuration Template
157
158```python
159pipeline_config = {
160 "task_type": "classification", # or "regression", "time_series"
161 "time_budget_seconds": 3600,
162 "algorithms": ["rf", "xgboost", "catboost", "lightgbm"],
163 "preprocessing": ["scaling", "encoding", "imputation"],
164 "tuning_strategy": "bayesian", # or "random", "hyperband"
165 "cv_folds": 5,
166 "cv_type": "purged_kfold", # or "walk_forward"
167 "embargo_bars": 10,
168 "early_stopping_rounds": 50,
169 "metric": "sharpe_ratio", # domain-specific metric
170}
171```
172
173### 5.4 Output Artifacts
174
175- `automl_config.py` -- pipeline configuration.
176- `best_model.pkl` / `.joblib` / `.onnx` -- serialised model.
177- `feature_pipeline.pkl` -- fitted preprocessing + feature transforms.
178- `evaluation_report.json` -- metrics, confusion matrix / residuals, feature rankings.
179- `deployment/` -- prediction API code, input validation, requirements.txt.
180
181---
182
183## 6. Core ML Fundamentals (Feature-Engineering Context)
184
185### 6.1 Bias-Variance Trade-off
186
187- More features increase model capacity (lower bias) but risk overfitting (higher variance).
188- Use regularisation (L1/L2), feature selection, or dimensionality reduction to manage.
189
190### 6.2 Evaluation Strategy
191
192- **Walk-forward validation**: the gold standard for time-series strategies.
193 Roll a fixed-width training window forward; test on the next out-of-sample period.
194- **Monte Carlo permutation tests**: shuffle labels and re-evaluate to estimate
195 the probability that observed performance is due to chance.
196- **Combinatorial purged CV (CPCV)**: generate many train/test combinations with
197 purging for more robust performance estimates.
198
199### 6.3 Feature Scaling
200
201- Fit scalers (StandardScaler, MinMaxScaler, RobustScaler) on the **training set only**.
202- Apply the same fitted scaler to validation and test sets.
203- RobustScaler is often preferred for financial data due to heavy tails.
204
205### 6.4 Handling Missing Data
206
207- Forward-fill then backward-fill for price data (be aware of leakage on backfill).
208- Indicator column for missingness can itself be informative.
209- Tree-based models can handle NaN natively; linear models cannot.
210
211---
212
213## 7. Workflow
214
215For any feature engineering task, follow this sequence:
216
2171. **Restate** the task in measurable terms (metric, constraints, deadline).
2182. **Enumerate** required artifacts: datasets, feature definitions, configs, scripts, reports.
2193. **Propose** a default approach and 1-2 alternatives with trade-offs.
2204. **Implement** feature pipeline with anti-leakage checks built in.
2215. **Validate** with walk-forward CV, Monte Carlo, and the leakage checklist above.
2226. **Deliver** repo-ready code, documentation, and a run command.
223
224---
225
226## 8. Deep Learning Optimization
227
228### 8.1 Optimizer Selection
229
230| Optimizer | Best For | Learning Rate |
231|-----------|----------|---------------|
232| Adam | Most cases, adaptive | 1e-3 to 1e-4 |
233| AdamW | Transformers, weight decay | 1e-4 to 1e-5 |
234| SGD + Momentum | Large batches, fine-tuning | 1e-2 to 1e-3 |
235| RAdam | Stability without warmup | 1e-3 |
236
237### 8.2 Learning Rate Scheduling
238
239- **OneCycleLR**: Best for short training, fast convergence
240- **CosineAnnealing**: Smooth decay, good generalization
241- **ReduceOnPlateau**: Adaptive when validation loss plateaus
242- **Warmup + Decay**: Standard for transformers
243
244### 8.3 Regularization Techniques
245
246- **Dropout**: 0.1-0.5 for fully connected layers
247- **L2 (Weight Decay)**: 1e-4 to 1e-2
248- **Batch Normalization**: Stabilizes training
249- **Early Stopping**: Monitor validation loss, patience 5-10 epochs
250
251### 8.4 PyTorch Lightning Integration
252
253```python
254import pytorch_lightning as pl
255
256class TradingModel(pl.LightningModule):
257 def configure_optimizers(self):
258 optimizer = torch.optim.AdamW(self.parameters(), lr=1e-4)
259 scheduler = torch.optim.lr_scheduler.OneCycleLR(
260 optimizer, max_lr=1e-3, total_steps=self.trainer.estimated_stepping_batches
261 )
262 return [optimizer], [scheduler]
263```
264
265### 8.5 Financial Reinforcement Learning
266
267- **State**: Market features, portfolio state, position
268- **Action**: Buy/Sell/Hold, position sizing
269- **Reward**: Risk-adjusted returns (Sharpe, Sortino)
270- **Frameworks**: Stable-Baselines3, RLlib, FinRL
271
272---
273
274## 9. Error Handling
275
276| Problem | Cause | Fix |
277|---------|-------|-----|
278| AutoML search finds no good model | Insufficient time budget or poor features | Increase budget, engineer better features, expand algorithm search space. |
279| Out of memory during training | Dataset too large for available RAM | Downsample, use incremental learning, simplify feature engineering. |
280| Model accuracy below threshold | Weak signal or overfitting | Collect more data, add domain-driven features, regularise, adjust metric. |
281| Feature transforms produce NaN/Inf | Division by zero, log of negative | Add guards: `np.where(denom != 0, ...)`, `np.log1p(np.abs(x))`. |
282| Optimiser fails to converge | Bad hyperparameter ranges | Tighten search bounds, increase iterations, exclude unstable algorithms. |
283
284---
285
286## 10. Bundled Scripts
287
288All scripts live in `scripts/` within this skill directory.
289
290| Script | Purpose |
291|--------|---------|
292| `data_validation.py` | Validate input data quality before pipeline execution. |
293| `model_evaluation.py` | Evaluate trained model performance and generate reports. |
294| `pipeline_deployment.py` | Deploy a trained pipeline to a target environment with rollback support. |
295| `feature_engineering_pipeline.py` | End-to-end feature engineering: load, clean, transform, select, train. |
296| `feature_importance_analyzer.py` | Analyse feature importance (permutation, SHAP, tree-based). |
297| `data_visualizer.py` | Visualise feature distributions and relationships to target. |
298| `feature_store_integration.py` | Integrate with feature stores (Feast, Tecton) for online/offline serving. |
299
300---
301
302## 11. Resources
303
304### Frameworks
305
306- **scikit-learn** -- preprocessing, feature selection, pipelines.
307- **Auto-sklearn / TPOT / H2O AutoML / PyCaret** -- automated pipeline search.
308- **Optuna** -- flexible hyperparameter optimisation.
309- **SHAP** -- model-agnostic feature importance.
310- **Feast / Tecton** -- feature store management.
311- **PyTorch Lightning** -- https://lightning.ai/docs/pytorch/stable/
312- **Stable-Baselines3** -- https://stable-baselines3.readthedocs.io/
313- **FinRL** -- https://github.com/AI4Finance-Foundation/FinRL
314
315### Key References
316
317- Lopez de Prado, *Advances in Financial Machine Learning* (2018) -- purged CV, fractional differentiation, meta-labelling.
318- Hastie, Tibshirani & Friedman, *The Elements of Statistical Learning* -- bias-variance, regularisation, model selection.
319- scikit-learn user guide: feature extraction, preprocessing, model selection.
320
321### Best Practices
322
323- Always start with a simple baseline before running AutoML.
324- Balance automation with domain knowledge -- blind search rarely beats informed priors.
325- Monitor resource consumption; set hard timeouts.
326- Validate on true out-of-sample holdout data, not just cross-validation.
327- Document every pipeline decision for reproducibility.