Complete the code to import the function that plots learning curves from sklearn.
from sklearn.model_selection import [1]
The learning_curve function is used to generate data for plotting learning curves.
Complete the code to generate training and validation scores for a model using learning_curve.
train_sizes, train_scores, test_scores = learning_curve(estimator, X, y, cv=[1])The cv parameter specifies the number of folds for cross-validation, commonly 5 or 10.
Fix the error in the code to correctly compute the mean training scores.
mean_train_scores = train_scores.[1](axis=1)
The mean method computes the average along the specified axis. Here, axis=1 averages across folds.
Fill both blanks to plot training and validation scores against training sizes.
plt.plot(train_sizes, mean_train_scores, label='[1]') plt.plot(train_sizes, mean_test_scores, label='[2]')
Training scores are plotted with label 'Training score' and validation scores with 'Validation score' to distinguish them clearly.
Fill all three blanks to complete the code that plots learning curves with labels and axis titles.
plt.xlabel('[1]') plt.ylabel('[2]') plt.title('[3]')
The x-axis label should be 'Training examples', y-axis label 'Score', and the plot title 'Learning Curve' for clarity.
