y_predicted_knn5_es = algorithm.knn_regressor(x_train, y_train, x_test, 5)
rmse, y_predicted_knn5 = compare_test(y_test, y_predicted_knn5_es)
print('RMSE KNN(5)  %.3f' % (rmse))

# KNN10
y_predicted_knn10_es = algorithm.knn_regressor(x_train, y_train, x_test, 10)
rmse, y_predicted_knn10 = compare_test(y_test, y_predicted_knn10_es)
print('RMSE KNN(10) %.3f' % (rmse))

# SGD
y_predicted_sgd_es = algorithm.sgd_regressor(x_train, y_train, x_test)
rmse, y_predicted_sgd = compare_test(y_test, y_predicted_sgd_es)
print('RMSE SGD     %.3f' % (rmse))

# Lasso
y_predicted_la_es = algorithm.lasso(x_train, y_train, x_test, normalize=False)
rmse, y_predicted_la = compare_test(y_test, y_predicted_la_es)
print('RMSE Lasso    %.3f' % (rmse))

# titles = ['Y', 'ElasticNet', 'ElasticNet Future', 'KNN5', 'KNN10']
# y_future_en = y_future_en[1]
# data = [y_hat_predicted, y_predicted_en, y_future_en, y_predicted_knn5, y_predicted_knn10]

titles = ['Y', 'ElasticNet', 'KNN5', 'KNN10', 'SGD', 'Lasso']
data = [y_hat_predicted, y_predicted_en, y_predicted_knn5, y_predicted_knn10, [], y_predicted_la]

date_test = date[split + 1:]
print('Length date test:' + str(len(date_test)))
print('Length data test:' + str(len(y_test)))

misc.plot_lines_graph('Stationary, Test Data ', date_test, titles, data)
y_hat_predicted = y_test
rmse = compare(y_test, y_hat_predicted)
print('RMSE NoPredic  %.3f' % (rmse))

# Dummy
y_predicted_dummy = x_test[:, -1]
rmse = compare(y_test, y_predicted_dummy)
print('RMSE Dummy   %.3f' % (rmse))

# ElasticNet
y_predicted_en, y_future_en = algorithm.elastic_net(x_train, y_train, x_test, y_test,normalize=True)
rmse = compare(y_test, y_predicted_en)
print('RMSE Elastic %.3f' % (rmse))

# Lasso
y_predicted_en = algorithm.lasso(x_train, y_train, x_test, normalize=True)
rmse = compare(y_test, y_predicted_en)
print('RMSE Lasso %.3f' % (rmse))

titles = ['Y', 'ElasticNet']
data = [y_test, y_predicted_en]

date_test = date[split:]
print('Length date test:' + str(len(date_test)))
print('Length data test:' + str(len(y_test)))

print(columns)


time_end = datetime.datetime.now()
print('End time: %s' % str(time_end.strftime('%Y-%m-%d %H:%M:%S')))
# KNN5
y_hat_predicted = algorithm.knn_regressor(x_train, y_train, x_test, 5)
rmse, y_predicted_knn5 = compare_test(test_scaled, y_hat_predicted)
print('RMSE KNN(5)  %.3f' % (rmse))

# KNN10
y_hat_predicted = algorithm.knn_regressor(x_train, y_train, x_test, 10)
rmse, y_predicted_knn10 = compare_test(test_scaled, y_hat_predicted)
print('RMSE KNN(10) %.3f' % (rmse))

# SGD
y_hat_predicted = algorithm.sgd_regressor(x_train, y_train, x_test)
rmse, y_predicted_sgd = compare_test(test_scaled, y_hat_predicted)
print('RMSE SGD     %.3f' % (rmse))

# Lasso
y_hat_predicted = algorithm.lasso(x_train, y_train, x_test, normalize=False)
rmse, y_predicted_la = compare_test(test_scaled, y_hat_predicted)
print('RMSE Lasso   %.3f' % (rmse))

# LSTM
y_hat_predicted = algorithm.lstm(x_train, y_train, x_test, batch_size=1, nb_epoch=200, neurons=3)
rmse, y_predicted_lstm = compare_test(test_scaled, y_hat_predicted)
print('RMSE LSTM   %.3f' % (rmse))

titles = ['X', 'Y', 'ElasticNet', 'KNN5', 'KNN10', 'SGD', 'Lasso','LSTM']
data = [raw_values[split:-1], y_predicted_real, y_predicted_en, y_predicted_knn5, y_predicted_knn10, y_predicted_sgd,
        y_predicted_la,y_predicted_lstm]
misc.plot_lines_graph('Stationary - Normalization, Test Data ', date[split:], titles, data)