Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -361,11 +361,12 @@ class StockPredictor:
|
|
| 361 |
|
| 362 |
# Streamlit App
|
| 363 |
st.set_page_config(layout="wide")
|
| 364 |
-
st.title("Deep Learning
|
| 365 |
|
| 366 |
# Include a short description in the main body of the app
|
| 367 |
st.markdown("""
|
| 368 |
-
This tool forecasts future stock prices and cryptocurrency pairs using a deep neural network with a large number of proprietary historical external variables.
|
|
|
|
| 369 |
""")
|
| 370 |
|
| 371 |
with st.expander("Additional Trading Tools and Analysis", expanded=False):
|
|
@@ -434,8 +435,8 @@ if run_button:
|
|
| 434 |
predictor.build_model()
|
| 435 |
progress_bar.progress(50)
|
| 436 |
|
| 437 |
-
status_text.text("Training model...")
|
| 438 |
-
predictor.train_model(epochs=10, batch_size=
|
| 439 |
progress_bar.progress(80)
|
| 440 |
|
| 441 |
status_text.text("Making predictions...")
|
|
@@ -462,14 +463,28 @@ if run_button:
|
|
| 462 |
bullish = final_predicted_price > last_actual_price
|
| 463 |
|
| 464 |
st.write(f"### Final Predicted Price: ${final_predicted_price:.2f}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 465 |
if bullish:
|
| 466 |
st.success("The model predicts a **bullish** trend over the forecast horizon.")
|
| 467 |
else:
|
| 468 |
st.error("The model predicts a **bearish** trend over the forecast horizon.")
|
| 469 |
-
|
| 470 |
-
st.write("""
|
| 471 |
**Interpretation of Results:**
|
| 472 |
-
The
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
""")
|
| 474 |
|
| 475 |
|
|
|
|
| 361 |
|
| 362 |
# Streamlit App
|
| 363 |
st.set_page_config(layout="wide")
|
| 364 |
+
st.title("Deep Learning Asset Price Forecasting")
|
| 365 |
|
| 366 |
# Include a short description in the main body of the app
|
| 367 |
st.markdown("""
|
| 368 |
+
This tool forecasts future stock prices and cryptocurrency pairs using a deep neural network with a large number of proprietary historical external variables.
|
| 369 |
+
The model provides both 68% and 95% confidence intervals to represent uncertainty.
|
| 370 |
""")
|
| 371 |
|
| 372 |
with st.expander("Additional Trading Tools and Analysis", expanded=False):
|
|
|
|
| 435 |
predictor.build_model()
|
| 436 |
progress_bar.progress(50)
|
| 437 |
|
| 438 |
+
status_text.text("Training model...This will take a few minutes")
|
| 439 |
+
predictor.train_model(epochs=10, batch_size=32)
|
| 440 |
progress_bar.progress(80)
|
| 441 |
|
| 442 |
status_text.text("Making predictions...")
|
|
|
|
| 463 |
bullish = final_predicted_price > last_actual_price
|
| 464 |
|
| 465 |
st.write(f"### Final Predicted Price: ${final_predicted_price:.2f}")
|
| 466 |
+
|
| 467 |
+
# Interpretation of results
|
| 468 |
+
ci_68_lower = future_predictions_df['CI_68_Lower'].iloc[-1]
|
| 469 |
+
ci_68_upper = future_predictions_df['CI_68_Upper'].iloc[-1]
|
| 470 |
+
ci_95_lower = future_predictions_df['CI_95_Lower'].iloc[-1]
|
| 471 |
+
ci_95_upper = future_predictions_df['CI_95_Upper'].iloc[-1]
|
| 472 |
+
mean_prediction = future_predictions_df['Predicted_Close'].mean()
|
| 473 |
+
|
| 474 |
+
st.write(f"### Final Predicted Price: ${final_predicted_price:.2f}")
|
| 475 |
+
|
| 476 |
if bullish:
|
| 477 |
st.success("The model predicts a **bullish** trend over the forecast horizon.")
|
| 478 |
else:
|
| 479 |
st.error("The model predicts a **bearish** trend over the forecast horizon.")
|
| 480 |
+
|
| 481 |
+
st.write(f"""
|
| 482 |
**Interpretation of Results:**
|
| 483 |
+
The model forecasts that the stock price is expected to be around **${final_predicted_price:.2f}** by the end of the forecast horizon. The 68% confidence interval suggests that the price is likely to fall between **${ci_68_lower:.2f}** and **${ci_68_upper:.2f}**, while the broader 95% confidence interval ranges from **${ci_95_lower:.2f}** to **${ci_95_upper:.2f}**.
|
| 484 |
+
|
| 485 |
+
On average, the forecasted prices over the horizon have a mean value of **${mean_prediction:.2f}**. The predicted trend indicates a **{'bullish' if bullish else 'bearish'}** signal, suggesting the price is expected to **{'rise' if bullish else 'decline'}** compared to the last recorded price of **${last_actual_price:.2f}**.
|
| 486 |
+
|
| 487 |
+
The confidence intervals represent the uncertainty in the model's predictions, with wider intervals indicating higher uncertainty. The shaded areas on the plot provide a visual representation of this uncertainty.
|
| 488 |
""")
|
| 489 |
|
| 490 |
|