我写了一个神经网络代码,我想给它添加隐藏层。我可以访问这一小部分代码:
trainX, trainY = create_dataset(train, look_back)
testX, testY = create_dataset(test, look_back)
trainX = numpy.reshape(trainX, (trainX.shape[0], 1, trainX.shape[1]))
testX = numpy.reshape(testX, (testX.shape[0], 1, testX.shape[1]))
model = Sequential()
model.add(LSTM(4, input_shape=(1, look_back)))
model.add(Dense(1))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(trainX, trainY, epochs=100, batch_size=1, verbose=2)
trainPredict = model.predict(trainX)
testPredict = model.predict(testX)
Run Code Online (Sandbox Code Playgroud)
有没有办法用这么多可用的信息向它添加隐藏层?此外,此代码在 Python3 中运行良好。
这将是一个很大的帮助。谢谢。
time-series python-3.x keras tensorflow recurrent-neural-network