ā¹ļø Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier |
| Last Crawled | 2026-04-07 16:03:21 (3 hours ago) |
| First Indexed | 2024-11-15 15:36:19 (1 year ago) |
| HTTP Status Code | 200 |
| Meta Title | CatBoostClassifier | CatBoost |
| Meta Description | class CatBoostClassifier (iterations= None, learning_rate= None, depth= None, l2_leaf_reg= None, model_size_reg= None, rsm= None, loss_function= None, border_co |
| Meta Canonical | null |
| Boilerpipe Text | class
CatBoostClassifier
(iterations=
None
,
learning_rate=
None
,
depth=
None
,
l2_leaf_reg=
None
,
model_size_reg=
None
,
rsm=
None
,
loss_function=
None
,
border_count=
None
,
feature_border_type=
None
,
per_float_feature_quantization=
None
,
input_borders=
None
,
output_borders=
None
,
fold_permutation_block=
None
,
od_pval=
None
,
od_wait=
None
,
od_type=
None
,
nan_mode=
None
,
counter_calc_method=
None
,
leaf_estimation_iterations=
None
,
leaf_estimation_method=
None
,
thread_count=
None
,
random_seed=
None
,
use_best_model=
None
,
verbose=
None
,
logging_level=
None
,
metric_period=
None
,
ctr_leaf_count_limit=
None
,
store_all_simple_ctr=
None
,
max_ctr_complexity=
None
,
has_time=
None
,
allow_const_label=
None
,
classes_count=
None
,
class_weights=
None
,
auto_class_weights=
None
,
one_hot_max_size=
None
,
random_strength=
None
,
name=
None
,
ignored_features=
None
,
train_dir=
None
,
custom_loss=
None
,
custom_metric=
None
,
eval_metric=
None
,
bagging_temperature=
None
,
save_snapshot=
None
,
snapshot_file=
None
,
snapshot_interval=
None
,
fold_len_multiplier=
None
,
used_ram_limit=
None
,
gpu_ram_part=
None
,
allow_writing_files=
None
,
final_ctr_computation_mode=
None
,
approx_on_full_history=
None
,
boosting_type=
None
,
simple_ctr=
None
,
combinations_ctr=
None
,
per_feature_ctr=
None
,
task_type=
None
,
device_config=
None
,
devices=
None
,
bootstrap_type=
None
,
subsample=
None
,
sampling_unit=
None
,
dev_score_calc_obj_block_size=
None
,
max_depth=
None
,
n_estimators=
None
,
num_boost_round=
None
,
num_trees=
None
,
colsample_bylevel=
None
,
random_state=
None
,
reg_lambda=
None
,
objective=
None
,
eta=
None
,
max_bin=
None
,
scale_pos_weight=
None
,
gpu_cat_features_storage=
None
,
data_partition=
None
metadata=
None
,
early_stopping_rounds=
None
,
cat_features=
None
,
grow_policy=
None
,
min_data_in_leaf=
None
,
min_child_samples=
None
,
max_leaves=
None
,
num_leaves=
None
,
score_function=
None
,
leaf_estimation_backtracking=
None
,
ctr_history_unit=
None
,
monotone_constraints=
None
,
feature_weights=
None
,
penalties_coefficient=
None
,
first_feature_use_penalties=
None
,
model_shrink_rate=
None
,
model_shrink_mode=
None
,
langevin=
None
,
diffusion_temperature=
None
,
posterior_sampling=
None
,
boost_from_average=
None
,
text_features=
None
,
tokenizers=
None
,
dictionaries=
None
,
feature_calcers=
None
,
text_processing=
None
,
fixed_binary_splits=
None
)
Purpose
Implementation of
the scikit-learn estimator API
for CatBoost classification.
Supports model training, inference and auxiliary calculations like feature importance.
The default optimized objective depends on various conditions:
Logloss ā The target has only two different values or the
target_border
parameter is not None.
MultiClass ā The target has more than two different values and the
target_border
parameter is None.
Parameters
metadata
Description
The key-value string pairs to store in the model's metadata storage after the training.
Default value
None
cat_features
Description
A one-dimensional array of categorical columns indices (specified as integers) or names (specified as strings).
This array can contain both indices and names for different elements.
If any features in the
cat_features
parameter are specified as names instead of indices, feature names must be provided for the training dataset. Therefore, the type of the
X
parameter in the future calls of the
fit
function must be either
catboost.Pool
with defined feature names data or pandas.DataFrame or
polars.DataFrame
.
Note
If this parameter is not None and the training dataset passed as the value of the X parameter to the fit function of this class has the
catboost.Pool
type, CatBoost checks the equivalence of the categorical features indices specification in this object and the one in the
catboost.Pool
object.
If this parameter is not None, passing objects of the
catboost.FeaturesData
type as the X parameter to the fit function of this class is prohibited.
Default value
None (all features are either considered numerical or of other types if specified precisely)
text_features
Description
A one-dimensional array of text columns indices (specified as integers) or names (specified as strings).
Use only if the data parameter is a two-dimensional feature matrix (has one of the following types: list, numpy.ndarray, pandas.DataFrame, pandas.Series,
polars.DataFrame
).
If any elements in this array are specified as names instead of indices, names for all columns must be provided. To do this, either use the
feature_names
parameter of this constructor to explicitly specify them or pass a pandas.DataFrame or
polars.DataFrame
with column names specified in the data parameter.
Default value
None (all features are either considered numerical or of other types if specified precisely)
SeeĀ
Python package training parameters
for the full list of parameters.
Note
Some parameters duplicate the ones specified for theĀ
fit
method. In these cases the values specified for theĀ
fit
method take precedence.
Attributes
tree_count_
Return the number of trees in the model.
This number can differ from the value specified in theĀ
--iterations
training parameter in the following cases:
The training is stopped by the
overfitting detector
.
TheĀ
--use-best-model
training parameter is set to
True
.
feature_importances_
Return the calculated
feature importances
. The output data depends on the type of the model's loss function:
Non-ranking loss functionsĀ ā
PredictionValuesChange
Ranking loss functionsĀ ā
LossFunctionChange
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
fit
Train a model.
predict
Apply the model to the given dataset.
predict_proba
Apply the model to the given dataset to predict the probability that the object belongs to the given classes.
calc_leaf_indexes
Returns indexes of leafs to which objects from pool are mapped by model trees.
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_all_params
Return the values of all training parameters (including the ones that are not explicitly specified by users).
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_borders
Return the list of borders for numerical features.
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 given parameter if it is explicitly by the user before starting the training. If this parameter is used with the default value, this function returns None.
get_params
Return the values of training parameters that are explicitly specified by the user. If all parameters are used with their default values, this function returns an empty dict.
get_probability_threshold
Get a threshold for class separation in binary classification task for a trained model.
get_scale_and_bias
Return the scale and bias of the model.
These values affect the results of applying the model, since the model prediction results are calculated as follows:
ā
l
e
a
f
_
v
a
l
u
e
s
ā
s
c
a
l
e
+
b
i
a
s
\sum leaf\_values \cdot scale + bias
get_test_eval
Return the formula values that were calculated for the objects from the validation dataset provided for training.
grid_search
A simple grid search over specified parameter values for a model.
is_fitted
Check whether the model is trained.
load_model
Load the model from a file.
plot_predictions
Sequentially vary the value of the specified features to put them into all buckets and calculate predictions for the input objects accordingly.
plot_tree
Visualize theĀ CatBoost decision trees.
randomized_search
A simple randomized search on hyperparameters.
save_borders
Save the model borders to a file.
save_model
Save the model to a file.
score
Calculate theĀ Accuracy
metric
for the objects in the given dataset.
select_features
Select the best features from the dataset using the
Recursive Feature Elimination
algorithm.
set_feature_names
Set names for all features in the model.
set_params
Set the training parameters.
set_probability_threshold
Set a threshold for class separation in binary classification task for a trained model.
set_scale_and_bias
Set the scale and bias.
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).
staged_predict_proba
Apply the model to the given dataset to predict the probability that the object belongs to the class and calculate the results taking into consideration only the trees in the range [0; i). |
| Markdown | [](https://catboost.ai/ "CatBoost")
- Installation
- [Overview](https://catboost.ai/docs/en/concepts/en/concepts/installation)
- Python package installation
- CatBoost for Apache Spark installation
- R package installation
- Command-line version binary
- Build from source
- Key Features
- Training parameters
- Python package
- [Quick start](https://catboost.ai/docs/en/concepts/en/concepts/python-quickstart)
- CatBoost
- CatBoostClassifier
- [Overview](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier)
- [fit](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_fit)
- [predict](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_predict)
- [predict\_proba](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_predict_proba)
- [Attributes](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
- [calc\_leaf\_indexes](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboost_calc_leaf_indexes)
- [calc\_feature\_statistics](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_calc_feature_statistics)
- [compare](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_modelcompare)
- [copy](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_copy)
- [eval\_metrics](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_eval-metrics)
- [get\_all\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_all_params)
- [get\_best\_iteration](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_best_iteration)
- [get\_best\_score](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_best_score)
- [get\_borders](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_borders)
- [get\_evals\_result](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_evals_result)
- [get\_feature\_importance](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_feature_importance)
- [get\_metadata](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_metadata)
- [get\_object\_importance](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_object_importance)
- [get\_param](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_param)
- [get\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_params)
- [get\_probability\_threshold](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_probability_threshold)
- [get\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_scale_and_bias)
- [get\_test\_eval](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_test_eval)
- [grid\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_grid_search)
- [is\_fitted](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_is_fitted)
- [load\_model](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_load_model)
- [plot\_predictions](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_plot_predictions)
- [plot\_tree](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_plot_tree)
- [randomized\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_randomized_search)
- [save\_borders](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_save_borders)
- [save\_model](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_save_model)
- [score](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_score)
- [select\_features](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_select_features)
- [set\_feature\_names](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_set_feature_names)
- [set\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_set_params)
- [set\_probability\_threshold](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_set_probability_threshold)
- [set\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_set_scale_and_bias)
- [shrink](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_shrink)
- [staged\_predict](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_staged_predict)
- [staged\_predict\_proba](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_staged_predict_proba)
- CatBoostRanker
- CatBoostRegressor
- [cv](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_cv)
- datasets
- FeaturesData
- MetricVisualizer
- Pool
- [sample\_gaussian\_process](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_sample_gaussian_process)
- [sum\_models](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_sum_models)
- [to\_classifier](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_to_classifier)
- [to\_regressor](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_to_regressor)
- [train](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_train)
- Text processing
- utils
- [Usage examples](https://catboost.ai/docs/en/concepts/en/concepts/python-usages-examples)
- CatBoost for Apache Spark
- R package
- Command-line version
- Applying models
- Objectives and metrics
- Model analysis
- Data format description
- [Parameter tuning](https://catboost.ai/docs/en/concepts/en/concepts/parameter-tuning)
- [Speeding up the training](https://catboost.ai/docs/en/concepts/en/concepts/speed-up-training)
- Data visualization
- Algorithm details
- [FAQ](https://catboost.ai/docs/en/concepts/en/concepts/faq)
- Educational materials
- [Development and contributions](https://catboost.ai/docs/en/concepts/en/concepts/development-and-contributions)
- [Contacts](https://catboost.ai/docs/en/concepts/en/concepts/contacts)
CatBoostClassifier
## In this article:
- [Purpose](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#purpose)
- [Parameters](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#parameters)
- [metadata](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#metadata)
- [cat\_features](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#cat_features)
- [text\_features](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#text_features)
- [Attributes](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#attributes)
- [tree\_count\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#tree_count_)
- [feature\_importances\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#feature_importances_)
- [random\_seed\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#random_seed_)
- [learning\_rate\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#learning_rate_)
- [feature\_names\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#feature_names_)
- [evals\_result\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#evals_result_)
- [best\_score\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#best_score_)
- [best\_iteration\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#best_iteration_)
- [classes\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#classes_)
- [Methods](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#methods)
- [fit](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#fit)
- [predict](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#predict)
- [predict\_proba](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#predict_proba)
- [calc\_leaf\_indexes](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#calc_leaf_indexes)
- [calc\_feature\_statistics](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#calc_feature_statistics)
- [compare](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#compare)
- [copy](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#copy)
- [eval\_metrics](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#eval_metrics)
- [get\_all\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_all_params)
- [get\_best\_iteration](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_best_iteration)
- [get\_best\_score](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_best_score)
- [get\_borders](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_borders)
- [get\_evals\_result](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_evals_result)
- [get\_feature\_importance](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_feature_importance)
- [get\_metadata](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_metadata)
- [get\_object\_importance](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_object_importance)
- [get\_param](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_param)
- [get\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_params)
- [get\_probability\_threshold](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_probability_threshold)
- [get\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_scale_and_bias)
- [get\_test\_eval](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_test_eval)
- [grid\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#grid_search)
- [is\_fitted](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#is_fitted)
- [load\_model](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#load_model)
- [plot\_predictions](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#plot_predictions)
- [plot\_tree](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#plot_tree)
- [randomized\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#randomized_search)
- [save\_borders](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#save_borders)
- [save\_model](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#save_model)
- [score](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#score)
- [select\_features](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#select_features)
- [set\_feature\_names](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#set_feature_names)
- [set\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#set_params)
- [set\_probability\_threshold](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#set_probability_threshold)
- [set\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#set_scale_and_bias)
- [shrink](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#shrink)
- [staged\_predict](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#staged_predict)
- [staged\_predict\_proba](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#staged_predict_proba)
1. Python package
2. CatBoostClassifier
3. Overview
# CatBoostClassifier
- [Purpose](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#purpose)
- [Parameters](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#parameters)
- [metadata](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#metadata)
- [cat\_features](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#cat_features)
- [text\_features](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#text_features)
- [Attributes](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#attributes)
- [tree\_count\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#tree_count_)
- [feature\_importances\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#feature_importances_)
- [random\_seed\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#random_seed_)
- [learning\_rate\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#learning_rate_)
- [feature\_names\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#feature_names_)
- [evals\_result\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#evals_result_)
- [best\_score\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#best_score_)
- [best\_iteration\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#best_iteration_)
- [classes\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#classes_)
- [Methods](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#methods)
- [fit](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#fit)
- [predict](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#predict)
- [predict\_proba](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#predict_proba)
- [calc\_leaf\_indexes](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#calc_leaf_indexes)
- [calc\_feature\_statistics](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#calc_feature_statistics)
- [compare](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#compare)
- [copy](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#copy)
- [eval\_metrics](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#eval_metrics)
- [get\_all\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_all_params)
- [get\_best\_iteration](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_best_iteration)
- [get\_best\_score](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_best_score)
- [get\_borders](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_borders)
- [get\_evals\_result](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_evals_result)
- [get\_feature\_importance](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_feature_importance)
- [get\_metadata](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_metadata)
- [get\_object\_importance](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_object_importance)
- [get\_param](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_param)
- [get\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_params)
- [get\_probability\_threshold](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_probability_threshold)
- [get\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_scale_and_bias)
- [get\_test\_eval](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#get_test_eval)
- [grid\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#grid_search)
- [is\_fitted](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#is_fitted)
- [load\_model](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#load_model)
- [plot\_predictions](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#plot_predictions)
- [plot\_tree](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#plot_tree)
- [randomized\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#randomized_search)
- [save\_borders](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#save_borders)
- [save\_model](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#save_model)
- [score](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#score)
- [select\_features](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#select_features)
- [set\_feature\_names](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#set_feature_names)
- [set\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#set_params)
- [set\_probability\_threshold](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#set_probability_threshold)
- [set\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#set_scale_and_bias)
- [shrink](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#shrink)
- [staged\_predict](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#staged_predict)
- [staged\_predict\_proba](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier#staged_predict_proba)
```
class CatBoostClassifier(iterations=None,
learning_rate=None,
depth=None,
l2_leaf_reg=None,
model_size_reg=None,
rsm=None,
loss_function=None,
border_count=None,
feature_border_type=None,
per_float_feature_quantization=None,
input_borders=None,
output_borders=None,
fold_permutation_block=None,
od_pval=None,
od_wait=None,
od_type=None,
nan_mode=None,
counter_calc_method=None,
leaf_estimation_iterations=None,
leaf_estimation_method=None,
thread_count=None,
random_seed=None,
use_best_model=None,
verbose=None,
logging_level=None,
metric_period=None,
ctr_leaf_count_limit=None,
store_all_simple_ctr=None,
max_ctr_complexity=None,
has_time=None,
allow_const_label=None,
classes_count=None,
class_weights=None,
auto_class_weights=None,
one_hot_max_size=None,
random_strength=None,
name=None,
ignored_features=None,
train_dir=None,
custom_loss=None,
custom_metric=None,
eval_metric=None,
bagging_temperature=None,
save_snapshot=None,
snapshot_file=None,
snapshot_interval=None,
fold_len_multiplier=None,
used_ram_limit=None,
gpu_ram_part=None,
allow_writing_files=None,
final_ctr_computation_mode=None,
approx_on_full_history=None,
boosting_type=None,
simple_ctr=None,
combinations_ctr=None,
per_feature_ctr=None,
task_type=None,
device_config=None,
devices=None,
bootstrap_type=None,
subsample=None,
sampling_unit=None,
dev_score_calc_obj_block_size=None,
max_depth=None,
n_estimators=None,
num_boost_round=None,
num_trees=None,
colsample_bylevel=None,
random_state=None,
reg_lambda=None,
objective=None,
eta=None,
max_bin=None,
scale_pos_weight=None,
gpu_cat_features_storage=None,
data_partition=None
metadata=None,
early_stopping_rounds=None,
cat_features=None,
grow_policy=None,
min_data_in_leaf=None,
min_child_samples=None,
max_leaves=None,
num_leaves=None,
score_function=None,
leaf_estimation_backtracking=None,
ctr_history_unit=None,
monotone_constraints=None,
feature_weights=None,
penalties_coefficient=None,
first_feature_use_penalties=None,
model_shrink_rate=None,
model_shrink_mode=None,
langevin=None,
diffusion_temperature=None,
posterior_sampling=None,
boost_from_average=None,
text_features=None,
tokenizers=None,
dictionaries=None,
feature_calcers=None,
text_processing=None,
fixed_binary_splits=None)
```
## Purpose
Implementation of [the scikit-learn estimator API](https://scikit-learn.org/stable/developers/develop.html) for CatBoost classification.
Supports model training, inference and auxiliary calculations like feature importance.
The default optimized objective depends on various conditions:
- Logloss ā The target has only two different values or the `target_border` parameter is not None.
- MultiClass ā The target has more than two different values and the `target_border` parameter is None.
## Parameters
### metadata
#### Description
The key-value string pairs to store in the model's metadata storage after the training.
**Default value**
None
### cat\_features
#### Description
A one-dimensional array of categorical columns indices (specified as integers) or names (specified as strings).
This array can contain both indices and names for different elements.
If any features in the `cat_features` parameter are specified as names instead of indices, feature names must be provided for the training dataset. Therefore, the type of the `X` parameter in the future calls of the `fit` function must be either [catboost.Pool](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_pool) with defined feature names data or pandas.DataFrame or [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html).
Note
- If this parameter is not None and the training dataset passed as the value of the X parameter to the fit function of this class has the [catboost.Pool](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_pool) type, CatBoost checks the equivalence of the categorical features indices specification in this object and the one in the [catboost.Pool](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_pool) object.
- If this parameter is not None, passing objects of the [catboost.FeaturesData](https://catboost.ai/docs/en/concepts/en/concepts/python-features-data__desc) type as the X parameter to the fit function of this class is prohibited.
**Default value**
None (all features are either considered numerical or of other types if specified precisely)
### text\_features
#### Description
A one-dimensional array of text columns indices (specified as integers) or names (specified as strings).
Use only if the data parameter is a two-dimensional feature matrix (has one of the following types: list, numpy.ndarray, pandas.DataFrame, pandas.Series, [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html)
).
If any elements in this array are specified as names instead of indices, names for all columns must be provided. To do this, either use the `feature_names` parameter of this constructor to explicitly specify them or pass a pandas.DataFrame or [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html) with column names specified in the data parameter.
**Default value**
None (all features are either considered numerical or of other types if specified precisely)
See [Python package training parameters](https://catboost.ai/docs/en/concepts/en/references/training-parameters/) for the full list of parameters.
Note
Some parameters duplicate the ones specified for the [fit](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_fit) method. In these cases the values specified for the [fit](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_fit) method take precedence.
## Attributes
### [tree\_count\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
Return the number of trees in the model.
This number can differ from the value specified in the `--iterations` training parameter in the following cases:
- The training is stopped by the [overfitting detector](https://catboost.ai/docs/en/concepts/en/concepts/overfitting-detector).
- The `--use-best-model` training parameter is set to "True".
### [feature\_importances\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
Return the calculated [feature importances](https://catboost.ai/docs/en/concepts/en/concepts/fstr). The output data depends on the type of the model's loss function:
- Non-ranking loss functions ā [PredictionValuesChange](https://catboost.ai/docs/en/concepts/en/concepts/fstr#regular-feature-importance)
- Ranking loss functions ā [LossFunctionChange](https://catboost.ai/docs/en/concepts/en/concepts/fstr#regular-feature-importances__lossfunctionchange)
### [random\_seed\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
The random seed used for training.
### [learning\_rate\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
The learning rate used for training.
### [feature\_names\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
The names of features in the dataset.
### [evals\_result\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
Return the values of metrics calculated during the training.
### [best\_score\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
Return the best result for each metric calculated on each validation dataset.
### [best\_iteration\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
Return the identifier of the iteration with the best result of the evaluation metric or loss function on the last validation set.
### [classes\_](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_attributes)
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
### [fit](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_fit)
Train a model.
### [predict](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_predict)
Apply the model to the given dataset.
### [predict\_proba](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_predict_proba)
Apply the model to the given dataset to predict the probability that the object belongs to the given classes.
### [calc\_leaf\_indexes](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboost_calc_leaf_indexes)
Returns indexes of leafs to which objects from pool are mapped by model trees.
### [calc\_feature\_statistics](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_calc_feature_statistics)
Calculate and plot a set of statistics for the chosen feature.
### [compare](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_modelcompare)
Draw train and evaluation metrics in [Jupyter Notebook](https://catboost.ai/docs/en/concepts/en/features/visualization_jupyter-notebook) for two trained models.
### [copy](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_copy)
Copy the CatBoost object.
### [eval\_metrics](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_eval-metrics)
Calculate the specified metrics for the specified dataset.
### [get\_all\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_all_params)
Return the values of all training parameters (including the ones that are not explicitly specified by users).
### [get\_best\_iteration](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_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](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_best_score)
Return the best result for each metric calculated on each validation dataset.
### [get\_borders](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_borders)
Return the list of borders for numerical features.
### [get\_evals\_result](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_evals_result)
Return the values of metrics calculated during the training.
### [get\_feature\_importance](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_feature_importance)
Calculate and return the [feature importances](https://catboost.ai/docs/en/concepts/en/concepts/fstr).
### [get\_metadata](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_metadata)
Return a proxy object with metadata from the model's internal key-value string storage.
### [get\_object\_importance](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_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](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_param)
Return the value of the given parameter if it is explicitly by the user before starting the training. If this parameter is used with the default value, this function returns None.
### [get\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_params)
Return the values of training parameters that are explicitly specified by the user. If all parameters are used with their default values, this function returns an empty dict.
### [get\_probability\_threshold](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_probability_threshold)
Get a threshold for class separation in binary classification task for a trained model.
### [get\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_scale_and_bias)
Return the scale and bias of the model.
These values affect the results of applying the model, since the model prediction results are calculated as follows:
ā l e a f \_ v a l u e s ā
s c a l e \+ b i a s \\sum leaf\\\_values \\cdot scale + bias āleaf\_valuesā
scale\+bias
### [get\_test\_eval](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_get_test_eval)
Return the formula values that were calculated for the objects from the validation dataset provided for training.
### [grid\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboost_grid_search)
A simple grid search over specified parameter values for a model.
### [is\_fitted](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_is_fitted)
Check whether the model is trained.
### [load\_model](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_load_model)
Load the model from a file.
### [plot\_predictions](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_plot_predictions)
Sequentially vary the value of the specified features to put them into all buckets and calculate predictions for the input objects accordingly.
### [plot\_tree](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_plot_tree)
Visualize the CatBoost decision trees.
### [randomized\_search](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboost_randomized_search)
A simple randomized search on hyperparameters.
### [save\_borders](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_save_borders)
Save the model borders to a file.
### [save\_model](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_save_model)
Save the model to a file.
### [score](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_score)
Calculate the Accuracy [metric](https://catboost.ai/docs/en/concepts/en/concepts/loss-functions) for the objects in the given dataset.
### [select\_features](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_select_features)
Select the best features from the dataset using the [Recursive Feature Elimination](https://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.RFE.html) algorithm.
### [set\_feature\_names](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_set_feature_names)
Set names for all features in the model.
### [set\_params](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_set_params)
Set the training parameters.
### [set\_probability\_threshold](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_set_probability_threshold)
Set a threshold for class separation in binary classification task for a trained model.
### [set\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostregressor_set_scale_and_bias)
Set the scale and bias.
### [shrink](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_shrink)
Shrink the model. Only trees with indices from the range `[ntree_start, ntree_end)` are kept.
### [staged\_predict](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_staged_predict)
Apply the model to the given dataset and calculate the results taking into consideration only the trees in the range \[0; i).
### [staged\_predict\_proba](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_staged_predict_proba)
Apply the model to the given dataset to predict the probability that the object belongs to the class and calculate the results taking into consideration only the trees in the range \[0; i).
### Was the article helpful?
Yes
No
Previous
[virtual\_ensembles\_predict](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_virtual_ensembles_predict)
Next
[fit](https://catboost.ai/docs/en/concepts/en/concepts/python-reference_catboostclassifier_fit)
 |
| Readable Markdown | ```
class CatBoostClassifier(iterations=None,
learning_rate=None,
depth=None,
l2_leaf_reg=None,
model_size_reg=None,
rsm=None,
loss_function=None,
border_count=None,
feature_border_type=None,
per_float_feature_quantization=None,
input_borders=None,
output_borders=None,
fold_permutation_block=None,
od_pval=None,
od_wait=None,
od_type=None,
nan_mode=None,
counter_calc_method=None,
leaf_estimation_iterations=None,
leaf_estimation_method=None,
thread_count=None,
random_seed=None,
use_best_model=None,
verbose=None,
logging_level=None,
metric_period=None,
ctr_leaf_count_limit=None,
store_all_simple_ctr=None,
max_ctr_complexity=None,
has_time=None,
allow_const_label=None,
classes_count=None,
class_weights=None,
auto_class_weights=None,
one_hot_max_size=None,
random_strength=None,
name=None,
ignored_features=None,
train_dir=None,
custom_loss=None,
custom_metric=None,
eval_metric=None,
bagging_temperature=None,
save_snapshot=None,
snapshot_file=None,
snapshot_interval=None,
fold_len_multiplier=None,
used_ram_limit=None,
gpu_ram_part=None,
allow_writing_files=None,
final_ctr_computation_mode=None,
approx_on_full_history=None,
boosting_type=None,
simple_ctr=None,
combinations_ctr=None,
per_feature_ctr=None,
task_type=None,
device_config=None,
devices=None,
bootstrap_type=None,
subsample=None,
sampling_unit=None,
dev_score_calc_obj_block_size=None,
max_depth=None,
n_estimators=None,
num_boost_round=None,
num_trees=None,
colsample_bylevel=None,
random_state=None,
reg_lambda=None,
objective=None,
eta=None,
max_bin=None,
scale_pos_weight=None,
gpu_cat_features_storage=None,
data_partition=None
metadata=None,
early_stopping_rounds=None,
cat_features=None,
grow_policy=None,
min_data_in_leaf=None,
min_child_samples=None,
max_leaves=None,
num_leaves=None,
score_function=None,
leaf_estimation_backtracking=None,
ctr_history_unit=None,
monotone_constraints=None,
feature_weights=None,
penalties_coefficient=None,
first_feature_use_penalties=None,
model_shrink_rate=None,
model_shrink_mode=None,
langevin=None,
diffusion_temperature=None,
posterior_sampling=None,
boost_from_average=None,
text_features=None,
tokenizers=None,
dictionaries=None,
feature_calcers=None,
text_processing=None,
fixed_binary_splits=None)
```
## Purpose
Implementation of [the scikit-learn estimator API](https://scikit-learn.org/stable/developers/develop.html) for CatBoost classification.
Supports model training, inference and auxiliary calculations like feature importance.
The default optimized objective depends on various conditions:
- Logloss ā The target has only two different values or the `target_border` parameter is not None.
- MultiClass ā The target has more than two different values and the `target_border` parameter is None.
## Parameters
### metadata
#### Description
The key-value string pairs to store in the model's metadata storage after the training.
**Default value**
None
### cat\_features
#### Description
A one-dimensional array of categorical columns indices (specified as integers) or names (specified as strings).
This array can contain both indices and names for different elements.
If any features in the `cat_features` parameter are specified as names instead of indices, feature names must be provided for the training dataset. Therefore, the type of the `X` parameter in the future calls of the `fit` function must be either [catboost.Pool](https://catboost.ai/docs/en/concepts/python-reference_pool) with defined feature names data or pandas.DataFrame or [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html).
Note
- If this parameter is not None and the training dataset passed as the value of the X parameter to the fit function of this class has the [catboost.Pool](https://catboost.ai/docs/en/concepts/python-reference_pool) type, CatBoost checks the equivalence of the categorical features indices specification in this object and the one in the [catboost.Pool](https://catboost.ai/docs/en/concepts/python-reference_pool) object.
- If this parameter is not None, passing objects of the [catboost.FeaturesData](https://catboost.ai/docs/en/concepts/python-features-data__desc) type as the X parameter to the fit function of this class is prohibited.
**Default value**
None (all features are either considered numerical or of other types if specified precisely)
### text\_features
#### Description
A one-dimensional array of text columns indices (specified as integers) or names (specified as strings).
Use only if the data parameter is a two-dimensional feature matrix (has one of the following types: list, numpy.ndarray, pandas.DataFrame, pandas.Series, [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html)
).
If any elements in this array are specified as names instead of indices, names for all columns must be provided. To do this, either use the `feature_names` parameter of this constructor to explicitly specify them or pass a pandas.DataFrame or [polars.DataFrame](https://docs.pola.rs/api/python/stable/reference/dataframe/index.html) with column names specified in the data parameter.
**Default value**
None (all features are either considered numerical or of other types if specified precisely)
See [Python package training parameters](https://catboost.ai/docs/en/references/training-parameters/) for the full list of parameters.
Note
Some parameters duplicate the ones specified for the [fit](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_fit) method. In these cases the values specified for the [fit](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_fit) method take precedence.
## Attributes
### [tree\_count\_](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_attributes)
Return the number of trees in the model.
This number can differ from the value specified in the `--iterations` training parameter in the following cases:
- The training is stopped by the [overfitting detector](https://catboost.ai/docs/en/concepts/overfitting-detector).
- The `--use-best-model` training parameter is set to "True".
### [feature\_importances\_](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_attributes)
Return the calculated [feature importances](https://catboost.ai/docs/en/concepts/fstr). The output data depends on the type of the model's loss function:
- Non-ranking loss functions ā [PredictionValuesChange](https://catboost.ai/docs/en/concepts/fstr#regular-feature-importance)
- Ranking loss functions ā [LossFunctionChange](https://catboost.ai/docs/en/concepts/fstr#regular-feature-importances__lossfunctionchange)
### [random\_seed\_](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_attributes)
The random seed used for training.
### [learning\_rate\_](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_attributes)
The learning rate used for training.
### [feature\_names\_](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_attributes)
The names of features in the dataset.
### [evals\_result\_](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_attributes)
Return the values of metrics calculated during the training.
### [best\_score\_](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_attributes)
Return the best result for each metric calculated on each validation dataset.
### [best\_iteration\_](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_attributes)
Return the identifier of the iteration with the best result of the evaluation metric or loss function on the last validation set.
### [classes\_](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_attributes)
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
### [fit](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_fit)
Train a model.
### [predict](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_predict)
Apply the model to the given dataset.
### [predict\_proba](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_predict_proba)
Apply the model to the given dataset to predict the probability that the object belongs to the given classes.
### [calc\_leaf\_indexes](https://catboost.ai/docs/en/concepts/python-reference_catboost_calc_leaf_indexes)
Returns indexes of leafs to which objects from pool are mapped by model trees.
### [calc\_feature\_statistics](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_calc_feature_statistics)
Calculate and plot a set of statistics for the chosen feature.
### [compare](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_modelcompare)
Draw train and evaluation metrics in [Jupyter Notebook](https://catboost.ai/docs/en/features/visualization_jupyter-notebook) for two trained models.
### [copy](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_copy)
Copy the CatBoost object.
### [eval\_metrics](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_eval-metrics)
Calculate the specified metrics for the specified dataset.
### [get\_all\_params](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_all_params)
Return the values of all training parameters (including the ones that are not explicitly specified by users).
### [get\_best\_iteration](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_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](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_best_score)
Return the best result for each metric calculated on each validation dataset.
### [get\_borders](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_borders)
Return the list of borders for numerical features.
### [get\_evals\_result](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_evals_result)
Return the values of metrics calculated during the training.
### [get\_feature\_importance](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_feature_importance)
Calculate and return the [feature importances](https://catboost.ai/docs/en/concepts/fstr).
### [get\_metadata](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_metadata)
Return a proxy object with metadata from the model's internal key-value string storage.
### [get\_object\_importance](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_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](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_param)
Return the value of the given parameter if it is explicitly by the user before starting the training. If this parameter is used with the default value, this function returns None.
### [get\_params](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_params)
Return the values of training parameters that are explicitly specified by the user. If all parameters are used with their default values, this function returns an empty dict.
### [get\_probability\_threshold](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_probability_threshold)
Get a threshold for class separation in binary classification task for a trained model.
### [get\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_scale_and_bias)
Return the scale and bias of the model.
These values affect the results of applying the model, since the model prediction results are calculated as follows:
ā l e a f \_ v a l u e s ā
s c a l e \+ b i a s \\sum leaf\\\_values \\cdot scale + bias
### [get\_test\_eval](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_get_test_eval)
Return the formula values that were calculated for the objects from the validation dataset provided for training.
### [grid\_search](https://catboost.ai/docs/en/concepts/python-reference_catboost_grid_search)
A simple grid search over specified parameter values for a model.
### [is\_fitted](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_is_fitted)
Check whether the model is trained.
### [load\_model](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_load_model)
Load the model from a file.
### [plot\_predictions](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_plot_predictions)
Sequentially vary the value of the specified features to put them into all buckets and calculate predictions for the input objects accordingly.
### [plot\_tree](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_plot_tree)
Visualize the CatBoost decision trees.
### [randomized\_search](https://catboost.ai/docs/en/concepts/python-reference_catboost_randomized_search)
A simple randomized search on hyperparameters.
### [save\_borders](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_save_borders)
Save the model borders to a file.
### [save\_model](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_save_model)
Save the model to a file.
### [score](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_score)
Calculate the Accuracy [metric](https://catboost.ai/docs/en/concepts/loss-functions) for the objects in the given dataset.
### [select\_features](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_select_features)
Select the best features from the dataset using the [Recursive Feature Elimination](https://scikit-learn.org/stable/modules/generated/sklearn.feature_selection.RFE.html) algorithm.
### [set\_feature\_names](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_set_feature_names)
Set names for all features in the model.
### [set\_params](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_set_params)
Set the training parameters.
### [set\_probability\_threshold](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_set_probability_threshold)
Set a threshold for class separation in binary classification task for a trained model.
### [set\_scale\_and\_bias](https://catboost.ai/docs/en/concepts/python-reference_catboostregressor_set_scale_and_bias)
Set the scale and bias.
### [shrink](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_shrink)
Shrink the model. Only trees with indices from the range `[ntree_start, ntree_end)` are kept.
### [staged\_predict](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_staged_predict)
Apply the model to the given dataset and calculate the results taking into consideration only the trees in the range \[0; i).
### [staged\_predict\_proba](https://catboost.ai/docs/en/concepts/python-reference_catboostclassifier_staged_predict_proba)
Apply the model to the given dataset to predict the probability that the object belongs to the class and calculate the results taking into consideration only the trees in the range \[0; i). |
| Shard | 169 (laksa) |
| Root Hash | 17435841955170310369 |
| Unparsed URL | ai,catboost!/docs/en/concepts/python-reference_catboostclassifier s443 |