mdified with inversed scaled data
Browse files
app.py
CHANGED
|
@@ -82,14 +82,20 @@ for i in range(100,(int(df_final.shape[0])+1) ):
|
|
| 82 |
|
| 83 |
for i in range(100,df_final.shape[0]):
|
| 84 |
# x_test.append(df_final[i-100:i])
|
| 85 |
-
y_test.append(df_final[i
|
| 86 |
|
| 87 |
x_test, y_test = np.array(x_test), np.array(y_test)
|
| 88 |
|
| 89 |
y_pred = model.predict(x_test)
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
scaler_val = scaler.scale_
|
| 92 |
-
scale_factor = 1/
|
| 93 |
y_pred = y_pred*scale_factor
|
| 94 |
y_test = y_test*scale_factor
|
| 95 |
|
|
@@ -104,8 +110,8 @@ plt.legend()
|
|
| 104 |
st.pyplot(fig2)
|
| 105 |
|
| 106 |
# also printing the next day closing price
|
| 107 |
-
last_predicted_price = round(float(
|
| 108 |
-
actual_closing_price = round(float(
|
| 109 |
|
| 110 |
# ls = "Predicted Upcoming Trading Day Closing Price: "
|
| 111 |
st.subheader("Predicted Upcoming Trading Day Closing Price: ")
|
|
|
|
| 82 |
|
| 83 |
for i in range(100,df_final.shape[0]):
|
| 84 |
# x_test.append(df_final[i-100:i])
|
| 85 |
+
y_test.append(df_final[i])
|
| 86 |
|
| 87 |
x_test, y_test = np.array(x_test), np.array(y_test)
|
| 88 |
|
| 89 |
y_pred = model.predict(x_test)
|
| 90 |
|
| 91 |
+
y_pred_tmp = y_pred
|
| 92 |
+
y_test_tmp = y_test
|
| 93 |
+
y_pred_tmp = scaler.inverse_transform(y_pred_tmp)
|
| 94 |
+
y_test_tmp = np.reshape(y_test_tmp,(-1,1))
|
| 95 |
+
y_test_tmp = scaler.inverse_transform(y_test_tmp)
|
| 96 |
+
|
| 97 |
scaler_val = scaler.scale_
|
| 98 |
+
scale_factor = 1/scaler_val
|
| 99 |
y_pred = y_pred*scale_factor
|
| 100 |
y_test = y_test*scale_factor
|
| 101 |
|
|
|
|
| 110 |
st.pyplot(fig2)
|
| 111 |
|
| 112 |
# also printing the next day closing price
|
| 113 |
+
last_predicted_price = round(float(y_pred_tmp[-1]),2)
|
| 114 |
+
actual_closing_price = round(float(y_test_tmp[-1]),2)
|
| 115 |
|
| 116 |
# ls = "Predicted Upcoming Trading Day Closing Price: "
|
| 117 |
st.subheader("Predicted Upcoming Trading Day Closing Price: ")
|