MCPcopy Create free account
hub / github.com/catboost/catboost / fit

Method fit

catboost/python-package/catboost/core.py:6068–6181  ·  view source on GitHub ↗

Fit the CatBoost model. Parameters ---------- X : catboost.Pool or list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.DataFrame If not catboost.Pool, 2 dimensional Feature matrix or string - file with dataset. y : list or numpy

(self, X, y=None, cat_features=None, text_features=None, embedding_features=None, graph=None,
            sample_weight=None, baseline=None, use_best_model=None,
            eval_set=None, verbose=None, logging_level=None, plot=False, plot_file=None, column_description=None,
            verbose_eval=None, metric_period=None, silent=None, early_stopping_rounds=None,
            save_snapshot=None, snapshot_file=None, snapshot_interval=None, init_model=None, callbacks=None,
            log_cout=None, log_cerr=None)

Source from the content-addressed store, hash-verified

6066 super(CatBoostRegressor, self).__init__(params)
6067
6068 def fit(self, X, y=None, cat_features=None, text_features=None, embedding_features=None, graph=None,
6069 sample_weight=None, baseline=None, use_best_model=None,
6070 eval_set=None, verbose=None, logging_level=None, plot=False, plot_file=None, column_description=None,
6071 verbose_eval=None, metric_period=None, silent=None, early_stopping_rounds=None,
6072 save_snapshot=None, snapshot_file=None, snapshot_interval=None, init_model=None, callbacks=None,
6073 log_cout=None, log_cerr=None):
6074 """
6075 Fit the CatBoost model.
6076
6077 Parameters
6078 ----------
6079 X : catboost.Pool or list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.DataFrame
6080 If not catboost.Pool, 2 dimensional Feature matrix or string - file with dataset.
6081
6082 y : list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.DataFrame or polars.Series, optional (default=None)
6083 Labels of the training data.
6084 If not None, can be a single- or two- dimensional array with numerical values.
6085 Use only if X is not catboost.Pool and does not point to a file.
6086
6087 cat_features : list or numpy.ndarray, optional (default=None)
6088 If not None, giving the list of Categ columns indices.
6089 Use only if X is not catboost.Pool.
6090
6091 text_features : list or numpy.ndarray, optional (default=None)
6092 If not None, giving the list of Text columns indices.
6093 Use only if X is not catboost.Pool.
6094
6095 embedding_features : list or numpy.ndarray, optional (default=None)
6096 If not None, giving the list of Embedding columns indices.
6097 Use only if X is not catboost.Pool.
6098
6099 graph : list or numpy.ndarray or pandas.DataFrame or polars.DataFrame
6100 The graph edges list description.
6101 If list or numpy.ndarrays or pandas.DataFrame or polars.DataFrame, giving 2 dimensional.
6102
6103 sample_weight : list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.Series, optional (default=None)
6104 Instance weights, 1 dimensional array like.
6105
6106 baseline : list or numpy.ndarray or polars.DataFrame or polars.Series, optional (default=None)
6107 If not None, giving 2 dimensional array like data.
6108 Use only if X is not catboost.Pool.
6109
6110 use_best_model : bool, optional (default=None)
6111 Flag to use best model
6112
6113 eval_set : catboost.Pool or list of catboost.Pool or tuple (X, y) or list [(X, y)], optional (default=None)
6114 Validation dataset or datasets for metrics calculation and possibly early stopping.
6115
6116 metric_period : int
6117 Frequency of evaluating metrics.
6118
6119 verbose : bool or int
6120 If verbose is bool, then if set to True, logging_level is set to Verbose,
6121 if set to False, logging_level is set to Silent.
6122 If verbose is int, it determines the frequency of writing metrics to output and
6123 logging_level is set to Verbose.
6124
6125 silent : bool

Calls 3

_get_canonized_paramsMethod · 0.80
_fitMethod · 0.45