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

Method fit

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

Fit the CatBoostRanker 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 n

(self, X, y=None, group_id=None, cat_features=None, text_features=None,
            embedding_features=None, pairs=None, graph=None, sample_weight=None, group_weight=None,
            subgroup_id=None, pairs_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

6474 super(CatBoostRanker, self).__init__(params)
6475
6476 def fit(self, X, y=None, group_id=None, cat_features=None, text_features=None,
6477 embedding_features=None, pairs=None, graph=None, sample_weight=None, group_weight=None,
6478 subgroup_id=None, pairs_weight=None, baseline=None, use_best_model=None,
6479 eval_set=None, verbose=None, logging_level=None, plot=False, plot_file=None, column_description=None,
6480 verbose_eval=None, metric_period=None, silent=None, early_stopping_rounds=None,
6481 save_snapshot=None, snapshot_file=None, snapshot_interval=None, init_model=None, callbacks=None,
6482 log_cout=None, log_cerr=None):
6483 """
6484 Fit the CatBoostRanker model.
6485 Parameters
6486 ----------
6487 X : catboost.Pool or list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.DataFrame
6488 If not catboost.Pool, 2 dimensional Feature matrix or string - file with dataset.
6489 y : list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.DataFrame or polars.Series, optional (default=None)
6490 Labels of the training data.
6491 If not None, can be a single-dimensional array with numerical values.
6492 Use only if X is not catboost.Pool and does not point to a file.
6493 group_id : numpy.ndarray or pandas.DataFrame or pandas.Series or polars.Series, optional (default=None)
6494 Ranking groups, 1 dimensional array like.
6495 Use only if X is not catboost.Pool.
6496 cat_features : list or numpy.ndarray, optional (default=None)
6497 If not None, giving the list of Categ columns indices.
6498 Use only if X is not catboost.Pool.
6499 text_features : list or numpy.ndarray, optional (default=None)
6500 If not None, giving the list of Text columns indices.
6501 Use only if X is not catboost.Pool.
6502 embedding_features : list or numpy.ndarray, optional (default=None)
6503 If not None, giving the list of Embedding columns indices.
6504 Use only if X is not catboost.Pool.
6505 pairs : list or numpy.ndarray or pandas.DataFrame or polars.DataFrame, optional (default=None)
6506 The pairs description in the form of a two-dimensional matrix of shape N by 2:
6507 N is the number of pairs.
6508 The first element of the pair is the zero-based index of the winner object from the input dataset for pairwise comparison.
6509 The second element of the pair is the zero-based index of the loser object from the input dataset for pairwise comparison.
6510 graph : list or numpy.ndarray or pandas.DataFrame or polars.DataFrame
6511 The graph edges list description.
6512 If list or numpy.ndarrays or pandas.DataFrame, giving 2 dimensional.
6513 sample_weight : list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.Series, optional (default=None)
6514 Instance weights, 1 dimensional array like.
6515 group_weight : list or numpy.ndarray or polars.Series (default=None)
6516 The weights of all objects within the defined groups from the input data in the form of one-dimensional array-like data.
6517 Used for calculating the final values of trees. By default, it is set to 1 for all objects in all groups.
6518 Only a weight or group_weight parameter can be used at a time
6519 subgroup_id : list or numpy.ndarray or polars.Series (default=None)
6520 Subgroup identifiers for all input objects. Supported identifier types are:
6521 int
6522 string types (string or unicode for Python 2 and bytes or string for Python 3).
6523 pairs_weight : list or numpy.ndarray or polars.Series (default=None)
6524 The weight of each input pair of objects in the form of one-dimensional array-like pairs.
6525 The number of given values must match the number of specified pairs.
6526 This information is used for calculation and optimization of Pairwise metrics .
6527 By default, it is set to 1 for all pairs.
6528 baseline : list or numpy.ndarray or polars.DataFrame or polars.Series, optional (default=None)
6529 If not None, giving 2 dimensional array like data.
6530 Use only if X is not catboost.Pool.
6531 use_best_model : bool, optional (default=None)
6532 Flag to use best model
6533 eval_set : catboost.Pool or list of catboost.Pool or tuple (X, y) or list [(X, y)], optional (default=None)

Calls 3

_get_canonized_paramsMethod · 0.80
_fitMethod · 0.45