CatBoost

class CatBoost(params=None)

Purpose

Training and applying models.

Parameters

Parameter Possible types Description Default value
params dict

The list of parameters to start training with.

If omitted, default values are used.

Note. Some parameters duplicate the ones specified for the fit method. In these cases the values specified for the fit method take precedence.
None
Parameter Possible types Description Default value
params dict

The list of parameters to start training with.

If omitted, default values are used.

Note. Some parameters duplicate the ones specified for the fit method. In these cases the values specified for the fit method take precedence.
None

Attributes

Attribute Description
tree_count_

Return the number of trees in the model.

feature_importances_
Return the calculated feature importances. The output data depends on the type of the model's loss function:
random_seed_

The random seed used for training.

learning_rate_

The learning rate used for training.

feature_names_

The names of features in the dataset.

evals_result_

Return the values of metrics calculated during the training.

best_score_

Return the best result for each metric calculated on each validation dataset.

best_iteration_

Return the identifier of the iteration with the best result of the evaluation metric or loss function on the last validation set.

classes_

Return the names of classes for classification models. An empty list is returned for all other models.

The order of classes in this list corresponds to the order of classes in resulting predictions.

Attribute Description
tree_count_

Return the number of trees in the model.

feature_importances_
Return the calculated feature importances. The output data depends on the type of the model's loss function:
random_seed_

The random seed used for training.

learning_rate_

The learning rate used for training.

feature_names_

The names of features in the dataset.

evals_result_

Return the values of metrics calculated during the training.

best_score_

Return the best result for each metric calculated on each validation dataset.

best_iteration_

Return the identifier of the iteration with the best result of the evaluation metric or loss function on the last validation set.

classes_

Return the names of classes for classification models. An empty list is returned for all other models.

The order of classes in this list corresponds to the order of classes in resulting predictions.

Methods

Method Description
fit

Train a model.

predict

Apply the model to the given dataset.

calc_feature_statistics

Calculate and plot a set of statistics for the chosen feature.

compare

Draw train and evaluation metrics in Jupyter Notebook for two trained models.

copy

Copy the CatBoost object.

eval_metrics

Calculate the specified metrics for the specified dataset.

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.

get_best_score

Return the best result for each metric calculated on each validation dataset.

get_evals_result

Return the values of metrics calculated during the training.

get_feature_importance

Calculate and return the feature importances.

get_metadata Return a proxy object with metadata from the model's internal key-value string storage.
get_object_importance
Calculate the effect of objects from the train dataset on the optimized metric values for the objects from the input dataset:
  • Positive values reflect that the optimized metric increases.
  • Negative values reflect that the optimized metric decreases.
get_param

Return the value of the specified training parameter.

get_params

Return the training parameters.

get_test_eval

Return the formula values that were calculated for the objects from the validation dataset provided for training.

is_fitted

Check whether the model is trained.

load_model

Load the model from a file.

plot_tree
Visualize the CatBoost decision trees.
save_model

Save the model to a file.

save_borders

Save the model borders to a file.

set_params

Set the training parameters.

shrink

Shrink the model. Only trees with indices from the range [ntree_start, ntree_end) are kept.

staged_predict

Apply the model to the given dataset and calculate the results taking into consideration only the trees in the range [0; i).

Method Description
fit

Train a model.

predict

Apply the model to the given dataset.

calc_feature_statistics

Calculate and plot a set of statistics for the chosen feature.

compare

Draw train and evaluation metrics in Jupyter Notebook for two trained models.

copy

Copy the CatBoost object.

eval_metrics

Calculate the specified metrics for the specified dataset.

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.

get_best_score

Return the best result for each metric calculated on each validation dataset.

get_evals_result

Return the values of metrics calculated during the training.

get_feature_importance

Calculate and return the feature importances.

get_metadata Return a proxy object with metadata from the model's internal key-value string storage.
get_object_importance
Calculate the effect of objects from the train dataset on the optimized metric values for the objects from the input dataset:
  • Positive values reflect that the optimized metric increases.
  • Negative values reflect that the optimized metric decreases.
get_param

Return the value of the specified training parameter.

get_params

Return the training parameters.

get_test_eval

Return the formula values that were calculated for the objects from the validation dataset provided for training.

is_fitted

Check whether the model is trained.

load_model

Load the model from a file.

plot_tree
Visualize the CatBoost decision trees.
save_model

Save the model to a file.

save_borders

Save the model borders to a file.

set_params

Set the training parameters.

shrink

Shrink the model. Only trees with indices from the range [ntree_start, ntree_end) are kept.

staged_predict

Apply the model to the given dataset and calculate the results taking into consideration only the trees in the range [0; i).