add_xgboost_regressor_constr

gurobi_ml.xgboost.xgboost_regressor.add_xgboost_regressor_constr(gp_model, xgboost_regressor, input_vars, output_vars=None, epsilon=0.0, safety_floor=0.0, **kwargs)

Formulate xgboost_regressor into gp_model.

The formulation predicts the values of output_vars using input_vars according to xgboost_regressor. See our User’s Guide for details on the mip formulation used.

Note that only “gbtree” regressors are supported at this point.

Parameters:
  • gp_model (Model) – The gurobipy model where the predictor should be inserted.

  • xgboost_regressor (xgboost.Booster) – The gradient boosting regressor to insert as predictor.

  • input_vars (mvar_array_like) – Decision variables used as input for gradient boosting regressor in gp_model.

  • output_vars (mvar_array_like, optional) – Decision variables used as output for gradient boosting regressor in gp_model.

  • epsilon (float, optional) – Small value used to impose strict inequalities for splitting nodes in MIP formulations.

  • safety_floor (float, optional) – Thresholds with absolute value smaller than this will be clamped to this value to avoid numerical issues with Gurobi’s tolerance. To be effective, this value must be larger than Gurobi FeasibilityTol. A smaller value will have no effect. Note that clamping can distort models whose legitimate split thresholds are genuinely small, so this parameter is opt-in (default 0.0, i.e. disabled).

Returns:

Object containing information about what was added to gp_model to formulate gradient_boosting_regressor.

Return type:

XGBoostRegressorConstr

Notes

See add_predictor_constr for acceptable values for input_vars and output_vars

Also see gurobi_ml.sklearn.decision_tree_regressor.add_decision_tree_regressor_constr() for specific parameters to model decision tree estimators.

Raises:

ModelConfigurationError – If the booster is not of type “gbtree”.