Open ghost opened 3 years ago
init_ip=test_data[215:] update_ip=list(init_ip) final_pred=[] i=0 pred_days=30 while(i<pred_days): if len(update_ip)>100: x_input=update_ip[1:] x_input=np.array(x_input).reshape(1,100,1) yhat=model.predict(x_input,verbose=0) update_ip.append(yhat[0].tolist()) new_pred=scaler.inverse_transform(yhat[0][0].reshape(-1,1))[0][0] print("{}day prediction is {}".format(i,new_pred)) final_pred.append(new_pred) update_ip=update_ip[1:] i+=1
else: x_input=np.array(init_ip).reshape(1,100,1) yhat=model.predict(x_input,verbose=0) update_ip.append(yhat[0].tolist()) new_pred=scaler.inverse_transform(yhat[0][0].reshape(-1,1))[0][0] final_pred.append(new_pred) print(new_pred) i+=1
This is the sample code sir,any idea on how to edit this to suit our model and dataset?
You can only predict closed price on the next day based on the input to my model, since it takes the numerical stock data as well as the data got from news headlines of the previous day
On Thu, May 13, 2021, 19:58 NocturnalSlob @.***> wrote:
init_ip=test_data[215:] update_ip=list(init_ip) final_pred=[] i=0 pred_days=30 while(i<pred_days): if len(update_ip)>100: x_input=update_ip[1:] x_input=np.array(x_input).reshape(1,100,1) yhat=model.predict(x_input,verbose=0) update_ip.append(yhat[0].tolist()) new_pred=scaler.inverse_transform(yhat[0][0].reshape(-1,1))[0][0] print("{}day prediction is {}".format(i,new_pred)) final_pred.append(new_pred) update_ip=update_ip[1:] i+=1
else: x_input=np.array(init_ip).reshape(1,100,1) yhat=model.predict(x_input,verbose=0) update_ip.append(yhat[0].tolist()) new_pred=scaler.inverse_transform(yhat[0][0].reshape(-1,1))[0][0] final_pred.append(new_pred) print(new_pred) i+=1
This is the sample code sir,any idea on how to edit this to suit our model and dataset?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pakshaljain05/Stock-Market-Prediction/issues/1#issuecomment-840598797, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANSIKQMTZ4NWVMBTQX54AXDTNPOXLANCNFSM442UYCNQ .
Does the model take the numerical stock data of the previous day only or the days before that too to predict the next day's stock price?And it considers the news headlines of the previous day to get the next day's price?
Also,why do we use shifted close price here sir?
Sir,do you have any idea how to implement this?I have a pseudocode but Im not able to use it on this model.Can you help?