Learning curve

A learning curve is a plot that compares how the training accuracy scores and the test accuracy scores vary as the number of samples/rows added to the data increases. In order to construct the learning curve for the k-nearest neighbors model, we use the following code:

skplt.estimators.plot_learning_curve(knn_classifier, features, target)plt.show()

This results in the following plot:

Learning curve for the K-NN model

In the preceding curve, the following applies:

  1. The training score and the test score are only the highest when the number of samples is 15,000. This suggests that even if we had only 15,000 samples (instead of ...

Get Machine Learning with scikit-learn Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.