Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import os os.environ['KMP_DUPLICATE_LIB_OK']='True' from xgboost import XGBRegressor
  2.  
  3. best_params = {'learning_rate': 0.16, 'n_estimators': 100,
  4. 'max_depth': 6, 'min_child_weight': 7,
  5. 'subsample': 0.9, 'colsample_bytree': 0.7, 'nthread': -1,
  6. 'scale_pos_weight': 1, 'random_state': 42,
  7.  
  8. #next parameters are used to enable gpu for fasting fitting
  9. 'tree_method': 'gpu_hist', 'max_bin': 16,
  10. 'gpu_id': 0
  11. }
  12.  
  13. xgb_model = XGBRegressor(
  14. **best_params)
  15.  
  16. xgb_model.fit(
  17. cur_train_x,
  18. cur_train_y,
  19. eval_metric="rmse",
  20. eval_set=[(cur_train_x, cur_train_y)],
  21. verbose=True,
  22. early_stopping_rounds = 10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement