Last active
September 21, 2024 11:06
-
-
Save deepak-karkala/9ae6c2833361414525f0baa0cf79c72d to your computer and use it in GitHub Desktop.
Script to study learning curve, model scalability, model performance
This file contains hidden or 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
from sklearn.model_selection import learning_curve | |
# sklearn's learning_curve function can be used for following purposes | |
# 1. Learning curve: To study how training and validation error varies with more training examples | |
# train_scores, valid_scores vs train_sizes | |
# 2. Model scalability: To study the time required to fit model as training data size increases | |
# fit_times vs train_sizes | |
# 3. Model performance: To study how training error changes with time required to fit | |
# train_scores vs fit_times | |
train_sizes, train_scores, valid_scores, fit_times, score_times = learning_curve(model, df_features, df_labels, | |
train_sizes=[0.25, 0.5, 0.75, 1], cv=10, | |
scoring="neg_mean_squared_error", | |
return_times=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment