def accuracy(self, yhat, y_test, final_cols, model_type): print("=====================") print("Accuracy Results") print("=====================\n") print(str(model_type)) columns = ['Open', 'High', 'Low', 'Close'] for i in range(0, 4): print(columns[i]) print("Mean absolute error =", round(sm.mean_absolute_error(y_test[:, i], yhat[:, i]), 4)) print( "Mean squared error =", round( sm.mean_squared_error(y_test[:, i], yhat[:, i], squared=True), 4)) print( "Explain variance score =", round(sm.explained_variance_score(y_test[:, i], yhat[:, i]), 4)) print( "RMSE =", round( sm.mean_squared_error(y_test[:, i], yhat[:, i], squared=False), 4)) print("R2 score =", round(sm.r2_score(y_test[:, i], yhat[:, i]), 4)) print("\nOverall Accuracy") print("Mean absolute error =", round(sm.mean_absolute_error(y_test, yhat), 4)) print("Mean squared error =", round(sm.mean_squared_error(y_test, yhat, squared=True), 4)) print("Explain variance score =", round(sm.explained_variance_score(y_test, yhat), 4)) print("RMSE =", round(sm.mean_squared_error(y_test, yhat, squared=False), 4)) print("R2 score =", round(sm.r2_score(y_test, yhat), 4)) print("R2 score =", round(sm.r2_score(y_test, yhat), 4)) if model_type == 'MLP': MLP.MLP_analyse(y_test, yhat, final_cols) if model_type == 'BASELINE': MLP.MLP_analyse(y_test, yhat, final_cols) if model_type == 'KNN': MLP.MLP_analyse(y_test, yhat, final_cols) if model_type == 'CNN': LSTMs.LSTM_analyse(self, y_test, yhat, final_cols) if model_type == 'LSTM': LSTMs.LSTM_analyse(self, y_test, yhat, final_cols) # with open('model_config/' + model_type + '.json', 'r') as params: # json_param = params.read() # obj = json.loads(json_param) self.logger.info(model_type) for i in range(0, 4): self.logger.info(columns[i]) self.logger.info( "Mean absolute error =%s", round(sm.mean_absolute_error(y_test[:, i], yhat[:, i]), 4)) self.logger.info( "Mean squared error =%s", round( sm.mean_squared_error(y_test[:, i], yhat[:, i], squared=True), 4)) self.logger.info( "Explain variance score =%s", round(sm.explained_variance_score(y_test[:, i], yhat[:, i]), 4)) self.logger.info( "RMSE =%s", round( sm.mean_squared_error(y_test[:, i], yhat[:, i], squared=False), 4)) self.logger.info("R2 score =%s", round(sm.r2_score(y_test[:, i], yhat[:, i]), 4)) self.logger.info("R2 score =%s", round(sm.r2_score(y_test, yhat), 4)) self.logger.info("End\n")