오답노트

[ML] Boosting - CatBoost 실습 본문

Python/ML

[ML] Boosting - CatBoost 실습

권멋져 2022. 9. 11. 21:24

CatBoostRegressor

# pip install catboost

import catboost as cbt

model_cbt = cbt.CatBoostRegressor()

params_cbt =    {'depth'         : [4,5,6,7,8,9, 10],
                 'learning_rate' : [0.01,0.02,0.03,0.04],
                  'iterations'    : [10 ,30,50,70, 100]
                 }

model_cbt_g = GridSearchCV(model_cbt,params_cbt,cv=10,verbose=3)

model_cbt_g.fit(x_train,y_train)

pred_cbt = model_cbt_g.predict(x_val)

ufs.Regressor_report(y_val,pred_cbt)

 

pip install catboost 를 통해 catboost를 먼저 설치해야 한다.

사용법은 Regressor와 Classifier와 같다.

 

hyper parameter

  • depth : 트리 모델의 크기를 정할 수 있다.
  • learning_rate : 각 모델의 예측값에 대한 비율을 설정할 수 있다.
  • iterations : 트리 모델의 개수를 정할 수 있다.