]> Piment Noir Git Repositories - freqai-strategies.git/commit
feat(quickadapter): add CatBoost regressor with RMSE loss function (#34)
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 8 Jan 2026 11:13:16 +0000 (12:13 +0100)
committerGitHub <noreply@github.com>
Thu, 8 Jan 2026 11:13:16 +0000 (12:13 +0100)
commitad61c24d488bbf9e9869b270949ca9e31a3bdca8
tree256cd4f4a641345e7deafeaaa76acec74adc3e18
parentf2f4602a7f4b37b0e13d30d8861485225216ea92
feat(quickadapter): add CatBoost regressor with RMSE loss function (#34)

* feat: add CatBoost regressor with RMSE loss function

Add CatBoost as the 5th regressor option using standard RMSE loss function.

Changes:
- Add catboost==1.2.8 to Dockerfile dependencies
- Update Regressor type literal to include 'catboost'
- Implement fit_regressor branch for CatBoost with:
  - RMSE loss function (default)
  - Early stopping and validation set handling
  - Verbosity parameter mapping
  - Sample weights support
  - Optuna CatBoostPruningCallback for trial pruning
- Add Optuna hyperparameter optimization with 6 parameters:
  - iterations: [100, 2000] (log-scaled)
  - learning_rate: [0.001, 0.3] (log-scaled)
  - depth: [4, 10] (tree depth)
  - l2_leaf_reg: [1, 10] (L2 regularization)
  - bagging_temperature: [0, 10] (Bayesian bootstrap)
  - random_strength: [1, 20] (split randomness)
- Update README.md regressor enum documentation

CatBoost advantages:
- Better accuracy than XGBoost/LightGBM (2024 benchmarks)
- GPU support for faster training
- Better categorical feature handling
- Strong overfitting resistance (ordered boosting)
- Production-ready at scale
- Optuna pruning callback for efficient hyperparameter search

* feat(catboost): add GPU/CPU differentiation for training and Optuna hyperparameters

- Add task_type-aware parameter handling in fit_regressor
- GPU mode: set devices, max_ctr_complexity=4, remove n_jobs
- CPU mode: propagate n_jobs to thread_count, max_ctr_complexity=2
- Trust CatBoost defaults for border_count (CPU=254, GPU=128)
- Differentiate Optuna hyperparameter search spaces by task_type
- GPU: depth=(4,12), border_count=(32,254), bootstrap=[Bayesian,Bernoulli]
- CPU: depth=(4,10), bootstrap=[Bayesian,Bernoulli,MVS]
- Add GPU-specific parameters: border_count, max_ctr_complexity
- Expand search space: min_data_in_leaf, grow_policy, model_size_reg, rsm, subsample
- Use CatBoost Pool for training with proper eval_set handling

* refactor(catboost): remove devices default to allow GPU auto-discovery

Trust CatBoost's automatic GPU device detection (default: all available GPUs).
Users can still explicitly set devices='0' or devices='0:1' in config if needed.

* fix(quickadapter): avoid forcing CatBoost thread_count when n_jobs unset

Remove nonstandard thread_count=-1 default in CPU CatBoost path.\nLet CatBoost select threads automatically unless n_jobs is provided.\nImproves consistency and avoids potential performance misinterpretation.

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix(catboost): properly omit incompatible bootstrap parameters

CatBoost strictly validates bootstrap parameters and rejects:
- subsample with Bayesian bootstrap
- bagging_temperature with non-Bayesian bootstrap

Even passing 'neutral' values (0 or 1.0) causes runtime errors.

Changed from ternary expressions (which always pass params) to
conditional dict building (which omits incompatible params entirely).

Also fixed: border_count min_val 16→1 per CatBoost documentation.

* refactor(quickadapter): replace plotting column names with constants

Replace string literals "minima", "maxima", and "smoothed-extrema" with MINIMA_COLUMN, MAXIMA_COLUMN, and SMOOTHED_EXTREMA_COLUMN constants following the existing *_COLUMN naming convention.

This improves maintainability and prevents typos when referencing these DataFrame column names throughout the codebase.

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
README.md
quickadapter/Dockerfile
quickadapter/user_data/freqaimodels/QuickAdapterRegressorV3.py
quickadapter/user_data/strategies/QuickAdapterV3.py
quickadapter/user_data/strategies/Utils.py