Skip to content

Commit

Permalink
making changed in the ml model
Browse files Browse the repository at this point in the history
  • Loading branch information
Incharajayaram committed Jul 3, 2024
1 parent 0a35128 commit 82900bc
Show file tree
Hide file tree
Showing 4 changed files with 754 additions and 341 deletions.
Binary file modified Latest_stcok_price_model.keras
Binary file not shown.
Binary file added Procfile
Binary file not shown.
1,070 changes: 729 additions & 341 deletions stockprice.ipynb

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions web_stock_price_predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,29 @@ def plot_graph(figsize, values, full_data, extra_data = 0, extra_dataset = None)
fig = plt.figure(figsize=(15,6))
plt.plot(pd.concat([google_data.Close[:splitting_len+100],ploting_data], axis=0))
plt.legend(["Data- not used", "Original Test data", "Predicted Test data"])
st.pyplot(fig)

st.subheader("Future Close Price values")

def predict_future_stock(no_of_days, prev_100):
future_predictions = []
prev_100 = scaler.fit_transform(prev_100['Adj Close'].values.reshape(-1,1)).reshape(1,-1,1)
for _ in range(no_of_days):
next_day = model.predict(prev_100)[0, 0]
future_predictions.append(next_day)
prev_100 = np.append(prev_100[:, 1:, :], [[[next_day]]], axis=1)
return scaler.inverse_transform(np.array(future_predictions).reshape(-1, 1)).flatten()

no_of_days = int(st.text_input("Enter the number of days to be predicted from current date : ", "10"))
future_results = predict_future_stock(no_of_days, prev_100= google_data[['Adj Close']].tail(100))
print(future_results)

future_results = np.array(future_results).reshape(-1,1)
fig = plt.figure(figsize = (15,5))
plt.plot(pd.DataFrame(future_results), marker = 'o')
for i in range(len(future_results)):
plt.text(i, future_results[i], int(future_results[i][0]))
plt.xlabel('Future days')
plt.ylabel('Close Price')
plt.title("Future Close price of stock")
st.pyplot(fig)

0 comments on commit 82900bc

Please sign in to comment.