Xgboost
from xgboost import XGBRegressor, plot_importance
model = XGBRegressor(
max_depth=17,
n_estimators=2110,
colsample_bytree=0.5,
min_child_weight=330,
subsample=0.8,
eta=0.2,
objective='reg:squarederror',
tree_method='gpu_hist')
model.fit(
X_train,
y_train,
eval_metric="rmse",
eval_set=[(X_train, Y_train), (X_valid, Y_valid)],
verbose=True,
early_stopping_rounds=10)
plot_features(model)
print(f"Test R2 score: {model.score(X_test, y_test):.2f}")
GPU acceleration
GPU acceleration
https://github.com/dmlc/xgboost/blob/master/demo/gpu_acceleration/tree_shap.py
params = {
"device": "cuda",
}