0
0
ML Pythonprogramming~20 mins

Learning curves in ML Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Learning Curve Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding 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?
ABoth training and validation errors decrease and then plateau as data size grows.
BThe training error increases and the validation error decreases steadily.
CTraining error remains constant while validation error fluctuates randomly.
DTraining error increases sharply while validation error remains zero.
Attempts:
2 left
Predict Output
intermediate
2:00remaining
Output 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))
A
[15 30 45 60 75]
[0.8 0.85 0.9 0.95 1. ]
[0.7 0.75 0.8 0.85 0.9]
B
[15 30 45 60 75]
[0.5 0.5 0.5 0.5 0.5]
[0.5 0.5 0.5 0.5 0.5]
C
[10 20 30 40 50]
[1. 1. 1. 1. 1.]
[1. 1. 1. 1. 1.]
D
[15 30 45 60 75]
[1.   0.98 0.97 0.96 0.95]
[0.95 0.94 0.93 0.92 0.91]
Attempts:
2 left
Hyperparameter
advanced
2:00remaining
Effect of model complexity on learning curves
How does increasing model complexity typically affect the shape of training and validation learning curves?
ABoth training and validation errors increase with model complexity.
BTraining error decreases but validation error first decreases then increases with complexity.
CTraining error increases and validation error decreases as complexity grows.
DTraining error decreases and validation error decreases steadily with complexity.
Attempts:
2 left
Metrics
advanced
2:00remaining
Interpreting 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?
AThe model is perfectly fitted with no issues.
BThe model is underfitting and needs more features.
CThe model is overfitting and more training data might help.
DThe data is too noisy and cannot be learned.
Attempts:
2 left
🔧 Debug
expert
2:00remaining
Diagnosing 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?
AThe scoring metric is incorrectly set to a metric that favors validation data.
BThe model is too simple and underfits the training data.
CThe training data is smaller than validation data causing unstable training scores.
DThe cross-validation splits are not stratified, causing unbalanced classes in training.
Attempts:
2 left