2
2
CatBoost Regressor Example.
3
3
4
4
This script demonstrates the usage of the CatBoost Regressor for a simple regression task.
5
- CatBoost is a powerful gradient boosting library that handles categorical features automatically
6
- and is highly efficient.
5
+ CatBoost is a powerful gradient boosting library that handles categorical features
6
+ automatically and is highly efficient.
7
7
8
8
Make sure to install CatBoost using:
9
9
pip install catboost
13
13
14
14
import numpy as np
15
15
from sklearn .datasets import fetch_california_housing
16
- from sklearn .model_selection import train_test_split
17
16
from sklearn .metrics import mean_squared_error
17
+ from sklearn .model_selection import train_test_split
18
18
from catboost import CatBoostRegressor
19
19
20
20
@@ -59,7 +59,9 @@ def catboost_regressor(features: np.ndarray, target: np.ndarray) -> CatBoostRegr
59
59
>>> isinstance(model, CatBoostRegressor)
60
60
True
61
61
"""
62
- regressor = CatBoostRegressor (iterations = 100 , learning_rate = 0.1 , depth = 6 , verbose = 0 )
62
+ regressor = CatBoostRegressor (
63
+ iterations = 100 , learning_rate = 0.1 , depth = 6 , verbose = 0
64
+ )
63
65
regressor .fit (features , target )
64
66
return regressor
65
67
@@ -97,4 +99,4 @@ def main() -> None:
97
99
import doctest
98
100
99
101
doctest .testmod (verbose = True )
100
- main ()
102
+ main ()
0 commit comments