y_hat_predicted = algorithm.knn_regressor(x_train, y_train, x_train, 5) rmse, y_predicted = compare_train(x_test, y_hat_predicted) print('RMSE KNN(5) %.3f' % (rmse)) # KNN10 y_hat_predicted = algorithm.knn_regressor(x_train, y_train, x_train, 10) rmse, y_predicted = compare_train(x_test, y_hat_predicted) print('RMSE KNN(10) %.3f' % (rmse)) # SGD y_hat_predicted = algorithm.sgd_regressor(x_train, y_train, x_train) rmse, y_predicted = compare_train(x_test, y_hat_predicted) print('RMSE SGD %.3f' % (rmse)) # LSTM y_hat_predicted = algorithm.lstm(x_train, y_train, x_train, batch_size=1, nb_epoch=3, neurons=1) rmse, y_predicted = compare_train(x_test, y_hat_predicted) print('RMSE LSTM %.3f' % (rmse)) print('------- Test --------') # No Prediction y_hat_predicted = y_test rmse, y_hat_predicted = compare_test(y_test, y_hat_predicted) print('RMSE NoPredic %.3f' % (rmse)) # Dummy y_predicted_dummy_es = x_test[:, 0] rmse, y_predicted_dummy = compare_test(y_test, y_predicted_dummy_es) print('RMSE Dummy %.3f' % (rmse)) # ElasticNet
print('RMSE KNN(10) %.3f' % (rmse)) # SGD y_predicted_sgd_sc = algorithm.sgd_regressor(x_train, y_train, x_test) rmse, y_predicted_sgd = compare_test(y_test, y_predicted_sgd_sc) print('RMSE SGD %.3f' % (rmse)) # Lasso y_predicted_la_sc = algorithm.lasso(x_train, y_train, x_test, normalize=False) rmse, y_predicted_la = compare_test(y_test, y_predicted_la_sc) print('RMSE Lasso %.3f' % (rmse)) # LSTM y_predicted_lstm = algorithm.lstm(x_train, y_train, x_test, batch_size=1, nb_epoch=200, neurons=3) rmse, y_predicted_lstm = compare_test(y_test, y_predicted_lstm) print('RMSE LSTM %.3f' % (rmse)) # print('Y_test') # print(y_test) titles = ['Y', 'ElasticNet', 'KNN5', 'KNN10', 'SGD', 'Lasso'] data = [ y_test, y_predicted_en, y_predicted_knn5, y_predicted_knn10, y_predicted_sgd, y_predicted_la ] # titles = ['', 'Y', 'ElasticNet', 'KNN5', 'KNN10', 'SGD'] # data = [[], y_test, y_predicted_en, y_predicted_knn5, y_predicted_knn10, y_predicted_sgd]