"max_depth": [2, 3, 5, 7, 10], "max_features":[2, 3], "n_estimators":[50 ,100, 150, 175, 200, 250, 300]} xgb_grid_search = GridSearchCV(estimator=XGBClassifier(), param_grid=param_grid, cv=5, verbose=2, n_jobs=-1) xgb_grid_search.fit(X_train, y_train) xgb_grid_search.best_params_ XGB_tuned = XGBClassifier(n_estimators=200, learning_rate=0.25, max_depth=20, max_features=2, random_state=42) XGB_tuned.fit(X_train, y_train) XGB_tuned.pred = XGB_tuned.predict(X_test) accuracy = accuracy_score(y_test, XGB_tuned.pred) fpr, tpr, thresholds = roc_curve(y_test, XGB_tuned.pred) auc_score = auc(fpr, tpr) print("Model : XGBoost (Grid Search Tuning)") print("Accuracy :", accuracy) print("AUC score:", auc_score) fig, ax = plot_confusion_matrix(conf_mat=confusion_matrix(y_test, XGB_tuned.pred), figsize=(8, 8), show_absolute=True, show_normed=False, colorbar=False, class_names=["Open", "Close"]) plt.title("Confusion Matrix of XGB") plt.show()