get_best_iteration
Return the identifier of the iteration with the best result of the evaluation metric or loss function on the last validation set.
Method call format
get_best_iteration()
Type of return value
int or None if the validation dataset is not specified.
Usage examples
from catboost import CatBoostClassifier, Pool
train_data = [[0,3],
[4,1],
[8,1],
[9,1]]
train_labels = [0,0,1,1]
eval_data = [[2,1],
[3,1],
[9,0],
[5,3]]
evalution_pool = Pool(eval_data)
model = CatBoostClassifier(learning_rate = 0.03, custom_metric = ['Logloss', 'AUC:hints=skip_train~false'])
model.fit(train_data, train_labels, eval_set=evalution_pool, verbose=False)
print(model.get_best_iteration())