tensortrade.pipeline.transformers.catboost_rfecv module¶
- class tensortrade.pipeline.transformers.catboost_rfecv.CatBoostRFECVTransformer(num_features: int = 20, seed: int = 42, *, iterations: int = 1000, target_column: str = 'close', target_shift: int = 3, task_type: str = 'CPU', learning_rate: float | None = None, max_depth: int = 8)[source]¶
Bases:
AbstractTransformer
Transformer for selecting top features using Recursive Feature Elimination with Cross-Validation (RFECV) with CatBoostRegressor as the underlying model.
- Parameters:
num_features (int) – The number of top features to select. (Default = 20)
seed (int) – The seed used for the RFECV. (Default = 42)
iterations (int) – CatBoostRegressor iterations. Should be at minimum 5 to 10 times the number of features. (Default = 1000)
target_column (str) – The name of the target column on which the feature elimination should be performed. (Default = ‘close’)
target_shift (int) – The number of periods to shift the target column to create the prediction target. (Default = 3)
task_type (str) – The type of the CatBoostRegressor task, can be CPU or GPU. (Default = ‘CPU’)
learning_rate (Optional[float]) – Learning rate used for the CatBoostRegressor. If None, it is chosen dynamically by CatBoost.
max_depth (int) – Max depth used for the CatBoostRegressor. (Default = 8)
- transform(df: DataFrame) DataFrame [source]¶
Transforms the input DataFrame by selecting the top features using RFECV with CatBoostRegressor.
- Parameters:
df (DataFrame) – The input DataFrame containing the features and target column.
- Returns:
A DataFrame reduced to the top features based on RFECV.
- Return type:
DataFrame