data_gen = TimeseriesGenerator(x_train,y_train,length=10, sampling_rate=2,batch_size=5110)
def rmsle_K(y, y0):
return K.sqrt(K.mean(K.square(tf.log1p(y) - tf.log1p(y0))))
regressor = Sequential()
regressor.add(Bidirectional(LSTM(units=100,return_sequences= True),input_shape=(x_train.shape[1],12)))
regressor.add(Dropout(0.1))
regressor.add(Bidirectional(LSTM(units=100,return_sequences= True)))
regressor.add(Dropout(0.1))
regressor.add(Bidirectional(LSTM(units=100,return_sequences= True)))
regressor.add(Dropout(0.1))
regressor.add(Dense(units=1))
regressor.compile(loss=keras.losses.mean_squared_logarithmic_error, optimizer='adam', metrics=[rmsle_K])
regressor.fit_generator(data_gen)
错误:
RuntimeError: You must compile your model before using it.
x_train.shape =(340,5110,12).y_train.shape =(3400,511,1)如何解决此错误?我觉得我在弄乱输入和输出尺寸,但是不确定。
我正在使用以下代码使我的LSTM网络适合时间序列生成器:data_gen = TimeseriesGenerator(x_train,y_train,length = 10,sample_rate = 2,batch_size = 5110)def rmsle_K(y,y0):...