quantlab.model.predefined.catboost_model.CatBoostRegressor#
- class quantlab.model.predefined.catboost_model.CatBoostRegressor(config)[source]#
Bases:
QlibLibraryHeadQlib’s CatBoost on the rows of the cross-sectional rank target.
The training target is Qlib’s
CSRankNorm(training_target"cs_rank"); NaN features are CatBoost’s missing values. The model fits with the validation rows as itseval_setanduse_best_model=True, stopping afterearly_stopping_patience(50) rounds without a better validation RMSE.task_typeis"GPU"when CatBoost sees a GPU, as in Qlib, unless set. Every other hyperparameter goes toCatBoostoverCATBOOST_ALPHA158, Qlib’s Alpha158 benchmark values:loss_function"RMSE",learning_rate0.0421,subsample0.8789,max_depth6,num_leaves100,thread_count20,grow_policy"Lossguide",bootstrap_type"Poisson"anditerations1000.Known difference from Qlib’s implementation: CatBoost accepts the benchmark’s Poisson bootstrap only on the GPU, so on the CPU it becomes Bernoulli with the same
subsample(logged), where Qlib’s config fails.- Parameters:
- configModelConfig
Factors, one label, dates and hyperparameters.
- Raises:
- ValueError
At training, if the model has more than one label.
Examples
>>> head = CatBoostRegressor(ModelConfig( ... factors=[factor], labels=[label], model_save_dir="checkpoints", ... factor_data_strategy="read", label_data_strategy="read", ... train_start="2024-01-01", train_end="2024-05-31", ... test_start="2024-06-01", test_end="2024-07-18", ... hyperparameters={"task_type": "CPU", "iterations": 50}, ... )).collect() >>> head.train().name 'CatBoostRegressor_total.joblib'
- DEFAULTS = {'bootstrap_type': 'Poisson', 'grow_policy': 'Lossguide', 'iterations': 1000, 'learning_rate': 0.0421, 'loss_function': 'RMSE', 'max_depth': 6, 'num_leaves': 100, 'subsample': 0.8789, 'thread_count': 20}#
The library’s parameters, Qlib’s benchmark values.