CatBoost

class CatBoost(params=None)

Purpose

Training and applying models.

Parameters

ParameterPossible typesDescriptionDefault value
paramsdict

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

AttributeDescription
tree_count_

Return the number of trees in the model.

feature_importances_

Output the calculated feature importances.

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.

Methods

MethodDescription
fit

Train a model.

predict

Apply the model to the given dataset.

staged_predict

Apply the model to the given dataset and calculate the results for each i-th tree of the model taking into consideration only the trees in the range [1;i].

eval_metrics

Calculate the specified metrics for the specified dataset.

get_feature_importance

Calculate and return the feature importances.

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.
load_model

Load the model from a file.

save_model

Save the model to a file.

shrink

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

get_param

Return the value of the specified training parameter.

get_params

Return the training parameters.

set_params

Set the training parameters.

copy

Copy the CatBoost object.

get_evals_result

Return the values of metrics calculated during the training.

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.

get_metadataReturn a proxy object with metadata from the model's internal key-value string storage.
get_best_score

Return the best result for each metric calculated on each validation 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.