Challenge - 5 Problems
Learning Curve Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediateUnderstanding the shape of learning curves
Which of the following best describes the typical shape of a learning curve for a well-trained machine learning model as the training data size increases?
Attempts:
2 left
💡 Hint
Think about how more data helps the model learn better but eventually gains become smaller.
✗ Incorrect
As training data increases, the model learns better, so both training and validation errors decrease. Eventually, they reach a plateau where adding more data doesn't improve performance much.
❓ Predict Output
intermediateOutput of learning curve plot code
What will be the output of the following Python code snippet using scikit-learn's learning_curve function?
ML Python
from sklearn.datasets import load_iris from sklearn.svm import SVC from sklearn.model_selection import learning_curve import numpy as np X, y = load_iris(return_X_y=True) train_sizes, train_scores, test_scores = learning_curve(SVC(kernel='linear'), X, y, train_sizes=np.linspace(0.1, 0.5, 5), cv=3) print(train_sizes) print(np.round(train_scores.mean(axis=1), 2)) print(np.round(test_scores.mean(axis=1), 2))
Attempts:
2 left
💡 Hint
Check the size of the iris dataset and the train_sizes parameter.
✗ Incorrect
The iris dataset has 150 samples. The train_sizes parameter creates 5 sizes from 10% to 50%, so sizes are [15,30,45,60,75]. The training scores are close to perfect for linear SVM, and test scores are slightly lower but close.
❓ Hyperparameter
advancedEffect of model complexity on learning curves
How does increasing model complexity typically affect the shape of training and validation learning curves?
Attempts:
2 left
💡 Hint
Think about overfitting and underfitting effects.
✗ Incorrect
As model complexity increases, training error usually decreases because the model fits training data better. Validation error decreases initially but then increases due to overfitting.
❓ Metrics
advancedInterpreting learning curve metrics
If a learning curve shows a large gap between training and validation errors that does not decrease with more data, what does this indicate?
Attempts:
2 left
💡 Hint
A large gap usually means the model fits training data too well but fails on new data.
✗ Incorrect
A persistent large gap between training and validation errors suggests overfitting. Adding more data can help the model generalize better.
🔧 Debug
expertDiagnosing incorrect learning curve results
A user runs learning_curve on a classification task but notices training scores are always lower than validation scores. What is the most likely cause?
Attempts:
2 left
💡 Hint
Think about how class distribution affects training and validation scores.
✗ Incorrect
If cross-validation splits are not stratified, training folds may have fewer samples of some classes, causing poor training scores compared to validation.
