Created
August 31, 2021 13:19
-
-
Save michelkana/bd46a041d776e1872f89de58eef31858 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
best_nb_iterations = np.array([ab_test_scores[:,i].argmax() for i in range(len(tree_depths)) ]) | |
best_test_scores = np.array([ab_test_scores[best_nb_iterations[i],i] for i in range(len(tree_depths)) ]) | |
optimal_tree_depth_idx = best_test_scores.argmax() | |
optimal_nb_iterations = best_nb_iterations[optimal_tree_depth_idx] | |
optimal_tree_depth = tree_depths[optimal_tree_depth_idx] | |
optimal_test_score = ab_test_scores[optimal_nb_iterations, optimal_tree_depth_idx] | |
optimal_train_score = ab_train_scores[optimal_nb_iterations, optimal_tree_depth_idx] | |
print('The combination of base learner depth {} and {} iterations achieves the best accuracy {}% on test set \ | |
and {}% on training set.'.format(optimal_tree_depth, optimal_nb_iterations, round(optimal_test_score*100,5), | |
round(optimal_train_score*100,5))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment