简体   繁体   English

在keras中训练LSTM时精度保持为零

[英]Accuracy remains zero while training LSTM in keras

I am trying to train LSTM, but while training accuracy remains zero in each epoch. 我正在尝试训练LSTM,但是训练精度在每个时期都保持为零。 I have transformed data to multivariate Time-series data and also shape in three-dimensional shape. 我已经将数据转换为多元时间序列数据,并且也以三维形状成形。 I also have normalised data using minmaxsaller. 我也使用minmaxsaller标准化了数据。

I have tried on a number of the epoch from 5 to 50 and batch size from 25 to 200. I have tried data samples from 1000000 to 1000 but none is working. 我尝试了从5到50的多个时期,批量大小从25到200的尝试。我尝试了1000000到1000的数据样本,但是没有一个工作。

Every time I am getting training accuracy zero only. 每次我获得的培训准确性仅为零时。

Can anyone help me in understanding it or suggest some more experiments. 任何人都可以帮助我理解它,或者提出一些更多的实验。

Following is my network. 以下是我的网络。

from keras.layers.core import Dense,Activation,Dropout
from keras.layers.recurrent import LSTM
from keras.models import Sequential
from keras.layers import Flatten

model = Sequential()
model.add(LSTM(50,return_sequences=True, input_shape=(X_train_values.shape[1], X_train_values.shape[2])))
model.add(Dropout(0.2))

model.add(Flatten())
model.add(Dense(1))

model.add(Activation('linear'))
model.compile(loss='mse',optimizer='rmsprop',metrics=['accuracy'])

history = model.fit(X_train_values, y_train.values,epochs=25, batch_size=30, verbose=2, shuffle=False)

me too, I'm a student from china, when I train LSTM model, the model's accuracy is very close zeros, but predicted answer and test collections is very close. 我也是我的中国学生,当我训练LSTM模型时,模型的精度非常接近零,但预测的答案和测试集却非常接近。 enter image description here 在此处输入图片说明

enter image description here 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM