Created
May 21, 2020 17:37
-
-
Save cereniyim/2aeea86c7c58a3d1260965aedd3738f1 to your computer and use it in GitHub Desktop.
function to train and evaluate the model with mean square error
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 fit_evaluate_model(model, X_train, y_train, | |
X_valid, y_valid): | |
# function to train a given model | |
# return mean squared error of the | |
# actuals and predictions | |
model.fit(X_train, y_train) | |
y_predicted = model.predict(X_valid) | |
return mean_squared_error(y_valid, y_predicted) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment