I have a dataset with three inputs and trying to predict next value of X1 with the combination of previous inputs values.
My three inputs are X1, X2, X3, X4.
So here I am trying to predict next future value of X1. To predict the next X1 these four inputs combination affect with:
X1 + X2 - X3 -X4
I wrote this code inside the class. Then I wrote the code to run the lstm . After that I wrote the code for predict value. Then it gave me this error. Can anyone help me to solve this problem?
my code:
def model_predict(data):
pred=[]
for index, row in data.iterrows():
val = row['X1']
if np.isnan(val):
data.iloc[index]['X1'] = pred[-1]
row['X1'] = pred[-1]
f = row['X1','X2','X3','X4']
s = row['X1'] - row['X2'] + row['X3'] -row['X4']
val = model.predict(s)
pred.append(val)
return np.array(pred)
After lstm code then I wrote the code for predict value:
pred = model_predict(x_test_n)
Gave me this error:
` ---> 5 pred = model_predict(x_test_n)
def model_predict(data):
pred=[]
-->for index, row in data.iterrows():
val = row['X1']
if np.isnan(val):`
AttributeError: 'numpy.ndarray' object has no attribute 'iterrows'