如何在RNN LSTM网络中使用评估指标?

时间:2020-09-15 19:07:57

标签: python tensorflow keras deep-learning lstm

我无法生成用于评估模型的指标。我已经完成了所有测试,甚至重新制定了重塑形式。有人能帮我吗? 数据标准化

print(x_train.shape)
print(y_train.shape)
print(x_test.shape)
print(y_test.shape)

(233634,15) (233634,) (100129,15) (100129,)

from sklearn.preprocessing import MinMaxScaler
normalizador = MinMaxScaler()
x_train= normalizador.fit_transform(x_train)
x_test = normalizador.fit_transform(x_test)
y_train = y_train.values.reshape(-1,1)
y_test = y_test.values.reshape(-1,1)

x_train= x_train.reshape(1, 233634, 15)
y_train= y_train.reshape(1, 233634, 1)
x_test = x_test.reshape(1, 100129, 15)
y_test = y_test.reshape(1, 100129, 1)
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Dense, Dropout, LSTM
model1 = Sequential()
model1.add(LSTM(units = 100, return_sequences = True))
model1.add(Dropout(0.3))

model1.add(LSTM(units = 50, return_sequences = True))
model1.add(Dropout(0.3))

model1.add(LSTM(units = 50, return_sequences = True))
model1.add(Dropout(0.3))

model1.add(LSTM(units = 50, return_sequences = True))
model1.add(Dropout(0.3))

# Camada Final
model1.add(Dense(1, activation='sigmoid'))

# Compile model
model1.compile(optimizer = 'Adam', loss = 'mean_squared_error',
                  metrics=['accuracy'])
# Fit the model
model1.fit(x_train,y_train, epochs=10, batch_size=10, validation_data=(x_test, y_test))

0 个答案:

没有答案