gators.model_building.XGBBoosterBuilder¶
-
class
gators.model_building.
XGBBoosterBuilder
[source]¶ XGBoost Booster Converter Class.
Examples
>>> import numpy as np >>> import xgboost as xgb >>> from gators.model_building import XGBBoosterBuilder >>> X_train = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]) >>> y_train = np.array([0, 1, 1, 0]) >>> model = xgb.XGBClassifier(eval_metric='logloss').fit(X_train, y_train) >>> xgbooster = XGBBoosterBuilder.train( ... model=model, ... X_train=X_train, ... y_train=y_train) >>> xgbooster.predict(xgb.DMatrix(X_train)) array([0.5, 0.5, 0.5, 0.5], dtype=float32)
-
static
train
(model: Union[xgboost.sklearn.XGBClassifier, xgboost.sklearn.XGBRegressor, xgboost.sklearn.XGBRFClassifier, xgboost.sklearn.XGBRFRegressor], X_train: numpy.ndarray, y_train: numpy.ndarray, num_class=None)[source]¶ Convert the XGBoost model to a XGB Booster model.
- Parameters
- modelUnion[XGBClassifier, XGBRegressor, XGBRFClassifier, XGBRFRegressor]
Trained xgboost.sklearn model.
- X_trainnp.ndarray
Train array.
- y_trainnp.ndarray
Target values.
- Returns
- xgboost.Booster
Trained xgboost Booster model.
-
static