randomized_search

https://catboost.ai/en/docs/concepts/python-reference_catboostregressor_randomized_search#example

  1. from catboost import CatBoostRegressor
  2. train_data = [[1, 4, 5, 6],
  3. [4, 5, 6, 7],
  4. [30, 40, 50, 60],
  5. [20, 30, 70, 60],
  6. [10, 80, 40, 30],
  7. [10, 10, 20, 30]]
  8. train_labels = [10, 20, 30, 15, 10, 25]
  9. model = CatBoostRegressor()
  10. grid = {'learning_rate': [0.03, 0.1],
  11. 'depth': [4, 6, 10],
  12. 'l2_leaf_reg': [1, 3, 5, 7, 9]}
  13. randomized_search_result = model.randomized_search(grid,
  14. X=train_data,
  15. y=train_labels,
  16. plot=True)

grid_search

https://catboost.ai/en/docs/concepts/python-reference_catboostregressor_grid_search#example

  1. from catboost import CatBoostRegressor
  2. import numpy as np
  3. train_data = np.random.randint(1, 100, size=(100, 10))
  4. train_labels = np.random.randint(2, size=(100))
  5. model = CatBoostRegressor()
  6. grid = {'learning_rate': [0.03, 0.1],
  7. 'depth': [4, 6, 10],
  8. 'l2_leaf_reg': [1, 3, 5, 7, 9]}
  9. grid_search_result = model.grid_search(grid,
  10. X=train_data,
  11. y=train_labels,
  12. plot=True)
  1. cb_model = CatBoostRegressor(iterations=700,
  2. learning_rate=0.02,
  3. depth=12,
  4. eval_metric='RMSE',
  5. random_seed = 23,
  6. bagging_temperature = 0.2,
  7. od_type='Iter',
  8. metric_period = 75,
  9. od_wait=100)