November 2019
Intermediate to advanced
346 pages
9h 36m
English
In the following steps, you will load the standard wine dataset and use Bayesian optimization to tune the hyperparameters of an XGBoost model:
from sklearn import datasetswine_dataset = datasets.load_wine()X = wine_dataset.datay = wine_dataset.target
import xgboost as xgbfrom sklearn.model_selection import StratifiedKFold
from skopt import BayesSearchCVn_iterations = 50
estimator = xgb.XGBClassifier( n_jobs=-1, objective="multi:softmax", ...