Keras中使用ClockworkRNN模型(cwrnn)

模型的训练和预测结果:

模型从epochs=0一直到99次迭代后的训练准确率和预测准确率曲线:

模型的简单使用方法:

model = Sequential()
model.add(ClockworkRNN(units=90,
                       period_spec=[1, 2, 4, 8, 16],
                       input_shape=train_x.shape[1:],  # ---(samples, timesteps, dimension)
                       dropout_W=0.4,
                       return_sequences=True,
                       debug=cwrnn_debug))  # debug is for developing mode, you can remove
model.add(Dropout(.2))
model.add(TimeDistributed(Dense(units=1, activation='linear')))
model.compile(loss='mse', optimizer='sgd', metrics=['accuracy'])

model.fit(train_x, train_y, epochs=epochs, batch_size=1, verbose=1)

猜你喜欢

转载自my.oschina.net/u/2996334/blog/1820618