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

Method fit

catboost/python-package/catboost/core.py:2758–2898  ·  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 or string. If not catboost.Pool or catboost.FeaturesData it must be 2 dimensional Feature matri

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

2756 return self
2757
2758 def fit(self, X, y=None, cat_features=None, text_features=None, embedding_features=None, pairs=None, graph=None, sample_weight=None, group_id=None,
2759 group_weight=None, subgroup_id=None, pairs_weight=None, baseline=None, use_best_model=None,
2760 eval_set=None, verbose=None, logging_level=None, plot=False, plot_file=None, column_description=None,
2761 verbose_eval=None, metric_period=None, silent=None, early_stopping_rounds=None,
2762 save_snapshot=None, snapshot_file=None, snapshot_interval=None, init_model=None, callbacks=None,
2763 log_cout=None, log_cerr=None):
2764 """
2765 Fit the CatBoost model.
2766
2767 Parameters
2768 ----------
2769 X : catboost.Pool or list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.DataFrame
2770 or string.
2771 If not catboost.Pool or catboost.FeaturesData it must be 2 dimensional Feature matrix
2772 or string - file with dataset.
2773
2774 Must be non-empty (contain > 0 objects)
2775
2776 y : list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.DataFrame or polars.Series, optional (default=None)
2777 Labels of the training data.
2778 If not None, can be a single- or two- dimensional array with either:
2779 - numerical values - for regression (including multiregression), ranking and binary classification problems
2780 - class labels (boolean, integer or string) - for classification (including multiclassification) problems
2781 Use only if X is not catboost.Pool and does not point to a file.
2782
2783 cat_features : list or numpy.ndarray, optional (default=None)
2784 If not None, giving the list of Categ columns indices.
2785 Use only if X is not catboost.Pool and not catboost.FeaturesData
2786
2787 text_features: list or numpy.ndarray, optional (default=None)
2788 If not none, giving the list of Text columns indices.
2789 Use only if X is not catboost.Pool and not catboost.FeaturesData
2790
2791 embedding_features: list or numpy.ndarray, optional (default=None)
2792 If not none, giving the list of Embedding columns indices.
2793 Use only if X is not catboost.Pool and not catboost.FeaturesData
2794
2795 pairs : list or numpy.ndarray or pandas.DataFrame or polars.DataFrame
2796 The pairs description.
2797 If list or numpy.ndarrays or pandas.DataFrame or polars.DataFrame, giving 2 dimensional.
2798 The shape should be Nx2, where N is the pairs' count. The first element of the pair is
2799 the index of the winner object in the training set. The second element of the pair is
2800 the index of the loser object in the training set.
2801
2802 graph : list or numpy.ndarray or pandas.DataFrame or polars.DataFrame
2803 The graph edges list description.
2804 If list or numpy.ndarrays or pandas.DataFrame, giving 2 dimensional.
2805
2806 sample_weight : list or numpy.ndarray or pandas.DataFrame or pandas.Series or polars.Series, optional (default=None)
2807 Instance weights, 1 dimensional array like.
2808
2809 group_id : list or numpy.ndarray or polars.Series, optional (default=None)
2810 group id for each instance.
2811 If not None, giving 1 dimensional array like data.
2812 Use only if X is not catboost.Pool.
2813
2814 group_weight : list or numpy.ndarray or polars.Series, optional (default=None)
2815 Group weight for each instance.

Calls 1

_fitMethod · 0.95