Created
December 20, 2017 18:40
-
-
Save messiest/bd4f5a404d57293023f57dc1347f4597 to your computer and use it in GitHub Desktop.
evaluate average runtime of a model
This file contains 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
def test_model(model, sample, k=5): | |
""" | |
get the mean time it takes to train the model over k-folds | |
""" | |
x = sample.copy() # set our predictors | |
y = x.pop('y') # set our response | |
mean_fit_time = np.mean(cross_validate(model, x, y, cv=k)['fit_time']) * 100 # get mean run time | |
return mean_fit_time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment