XGBRegressor.fit(X, y, sample_weight=None, base_margin=None, eval_set=None, sample_weight_eval_set=None, base_margin_eval_set=None, **kw)[source]#

Fit gradient boosting model.

Note that calling fit() multiple times will cause the model object to be re-fit from scratch. To resume training from a previous checkpoint, explicitly pass xgb_model argument.

  • X

    Feature matrix. See py-data for a list of supported types.

    When the tree_method is set to hist, internally, the QuantileDMatrix will be used instead of the DMatrix for conserving memory. However, this has performance implications when the device of input data is not matched with algorithm. For instance, if the input is a numpy array on CPU but cuda is used for training, then the data is first processed on CPU then transferred to GPU.

  • y – Labels

  • sample_weight – instance weights

  • base_margin – global bias for each instance.

  • eval_set – A list of (X, y) tuple pairs to use as validation sets, for which metrics will be computed. Validation metrics will help us track the performance of the model.

  • eval_metric (str, list of str, or callable, optional (Not supported yet)) –

    Deprecated since version 1.6.0(xgboost).

    Use eval_metric in __init__() or set_params() instead.

  • early_stopping_rounds (int (Not supported yet)) –

    Deprecated since version 1.6.0(xgboost).

    Use early_stopping_rounds in __init__() or set_params() instead.

  • verbose ((Not supported yet)) – If verbose is True and an evaluation set is used, the evaluation metric measured on the validation set is printed to stdout at each boosting stage. If verbose is an integer, the evaluation metric is printed at each verbose boosting stage. The last boosting stage / the boosting stage found by using early_stopping_rounds is also printed.

  • xgb_model ((Not supported yet)) – file name of stored XGBoost model or ‘Booster’ instance XGBoost model to be loaded before training (allows training continuation).

  • sample_weight_eval_set – A list of the form [L_1, L_2, …, L_n], where each L_i is an array like object storing instance weights for the i-th validation set.

  • base_margin_eval_set – A list of the form [M_1, M_2, …, M_n], where each M_i is an array like object storing base margin for the i-th validation set.

  • feature_weights ((Not supported yet)) – Weight for each feature, defines the probability of each feature being selected when colsample is being used. All values must be greater than 0, otherwise a ValueError is thrown.

  • callbacks ((Not supported yet)) –

    Deprecated since version 1.6.0(xgboost): Use callbacks in __init__() or set_params() instead.

This docstring was copied from xgboost.sklearn.XGBRegressor.