Here I tried to predict the value according to the actual value using LSTM regression model. After prediction the value I need to find the prediction accuracy percentage of predict values with actual value.
I tried but it gave me large minus value.
Here is my code:
pred=model.predict(x_test)
pred = scaler_y.inverse_transform(np.array(pred).reshape ((len(pred), 1)))
real_test = scaler_y.inverse_transform(np.array(y_test).reshape ((len(y_test),1))).astype(int)
pred = pred[:,0]
real_test = real_test[:,0]
from sklearn.metrics import accuracy_score
from sklearn.metrics import mean_squared_error
accuracy_regression = mean_squared_error(real_test, pred)
print(accuracy_regression)
accuracy = 1-np.sqrt(accuracy_regression)
print("Prediction Accuracy: %.2f%%" % (accuracy*100))
Then output:
394.2002447320037
Prediction Accuracy: -1885.45%
This is wrong. Can anyone help me to solve this error?