Exercise

Cross-validation scoring

Now, you should use cross-validation scoring with cross_val_score() to check the overall performance.

This is exercise presents an excellent opportunity to test out the use of the hyperparameters learning_rate and max_depth. Remember, hyperparameters are like settings which can help create optimum performance.

The data sets cr_loan_prep, X_train, and y_train have already been loaded in the workspace.

Instructions

100 XP
  • Create a gradient boosted tree with a learning rate of 0.1 and a max depth of 7. Store the model as gbt.
  • Calculate the cross validation scores against the X_train and y_train data sets with 4 folds. Store the results as cv_scores.
  • Print the cross validation scores.
  • Print the average accuracy score and standard deviation with formatting.