Skip to content

Instantly share code, notes, and snippets.

@ashwinprasadme
Last active December 15, 2020 10:48
Show Gist options
  • Save ashwinprasadme/80fe0bebdce5853323137e91d6ef0d5a to your computer and use it in GitHub Desktop.
Save ashwinprasadme/80fe0bebdce5853323137e91d6ef0d5a to your computer and use it in GitHub Desktop.
np.sqrt(((dataY_plot[-testX.size()[0]:] - data_predict[-testX.size()[0]:] ) ** 2).mean())
MAE = mean_absolute_error(LSTM_test_outputs, predictions)
def model_score(model, X_train, y_train, X_test, y_test):
trainScore = model.evaluate(X_train, y_train, verbose=0)
print('Train Score: %.5f MSE (%.2f RMSE)' % (trainScore[0], math.sqrt(trainScore[0])))
testScore = model.evaluate(X_test, y_test, verbose=0)
print('Test Score: %.5f MSE (%.2f RMSE)' % (testScore[0], math.sqrt(testScore[0])))
return trainScore[0], testScore[0]
model_score(model, X_train, y_train, X_test, y_test)
def return_rmse(test,predicted):
rmse = math.sqrt(mean_squared_error(test, predicted))
print("The root mean squared error is {}.".format(rmse))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment