File size: 980 Bytes
829e3ac
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

"""
This module sets up a LightGBM Regressor with hyperparameter tuning.

Features:
- Uses `LGBMRegressor` estimator from LightGBM.
- Defines a hyperparameter grid for boosting parameters.
- Optimized for speed and performance.

Special Considerations:
- Requires the `lightgbm` library (`pip install lightgbm`).
- Can handle categorical features if provided appropriately.
- Not sensitive to feature scaling.
"""

from lightgbm import LGBMRegressor

# Define the estimator
estimator = LGBMRegressor(
    random_state=42,
    n_jobs=-1,
    verbose=-1
)

# Define hyperparameter grid
param_grid = {
    'model__n_estimators': [100, 200],
    'model__learning_rate': [0.01, 0.05],
    'model__num_leaves': [15, 31],
    'model__max_depth': [10, 20],
    'model__min_data_in_leaf': [20, 50],
    'model__colsample_bytree': [0.8],
    'preprocessor__num__imputer__strategy': ['mean'],
}

# Optional: Define the default scoring metric
default_scoring = 'neg_root_mean_squared_error'