Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os os.environ['KMP_DUPLICATE_LIB_OK']='True' from xgboost import XGBRegressor
- best_params = {'learning_rate': 0.16, 'n_estimators': 100,
- 'max_depth': 6, 'min_child_weight': 7,
- 'subsample': 0.9, 'colsample_bytree': 0.7, 'nthread': -1,
- 'scale_pos_weight': 1, 'random_state': 42,
- #next parameters are used to enable gpu for fasting fitting
- 'tree_method': 'gpu_hist', 'max_bin': 16,
- 'gpu_id': 0
- }
- xgb_model = XGBRegressor(
- **best_params)
- xgb_model.fit(
- cur_train_x,
- cur_train_y,
- eval_metric="rmse",
- eval_set=[(cur_train_x, cur_train_y)],
- verbose=True,
- early_stopping_rounds = 10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement