]> Piment Noir Git Repositories - freqai-strategies.git/commit
Remove Optuna "train" namespace as preliminary step to eliminate data leakage
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 2 Jan 2026 23:05:31 +0000 (00:05 +0100)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 2 Jan 2026 23:05:31 +0000 (00:05 +0100)
commit00de252a8aaaad3d74142cd3412445cd08d4988c
treeba051fc0bc2493f005326a64c4807e246fceead8
parent94bf75815f17d0b1bbdc9bca79ce413a3877032f
Remove Optuna "train" namespace as preliminary step to eliminate data leakage

Remove the "train" namespace from Optuna hyperparameter optimization to
address data leakage issues in extrema weighting normalization. This is a
preliminary step before implementing a proper data preparation pipeline
that prevents train/test contamination.

Problem:
Current architecture applies extrema weighting normalization (minmax, softmax,
zscore, etc.) on the full dataset BEFORE train/test split. This causes data
leakage: train set labels are normalized using statistics (min/max, mean/std,
median/IQR) computed from the entire dataset including test set. The "train"
namespace hyperopt optimization exacerbates this by optimizing dataset
truncation with contaminated statistics.

Solution approach:
1. Remove "train" namespace optimization (this commit)
2. Switch to binary extrema labels (strategy: "none") to avoid leakage
3. Future: implement proper data preparation that computes normalization
   statistics on train set only and applies them to both train/test sets

This naive train/test splitting hyperopt is incompatible with a correct
data preparation pipeline where normalization must be fit on train and
transformed on test separately.

Changes:
- Remove "train" namespace from OptunaNamespace (3→2 namespaces: hp, label)
- Remove train_objective function and all train optimization logic
- Remove dataset truncation based on optimized train/test periods
- Update namespace indices: label from [2] to [1] throughout codebase
- Remove train_candles_step config parameter and train_rmse metric tracking
- Set extrema_weighting.strategy to "none" (binary labels: -1/0/+1)
- Update documentation to reflect 2-namespace architecture

Files modified:
- QuickAdapterRegressorV3.py: -204 lines (train namespace removal)
- QuickAdapterV3.py: remove train_rmse from plot config
- config-template.json: remove train params, set extrema_weighting to none
- README.md: update documentation (remove train_candles_step reference)
README.md
quickadapter/user_data/config-template.json
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py