0
我使用均方誤差來計算多輸出迴歸器的損失函數。我使用了一對多架構的遞歸神經網絡模型。我的輸出矢量大小爲6(1 * 6),值是單調的(非遞減)。在多輸出迴歸中對均方誤差成本函數添加約束條件
例如: Y_I = [1,3,6,13,30,57,201]
我想強制模型學習這種依賴性。因此增加了成本函數的約束。我在驗證集上收到了一個等於300的錯誤。我相信在編輯均方誤差損失函數後,我將能夠獲得更好的性能。
我正在使用keras執行。這是核心模式。
batchSize = 256
epochs = 20
samplesData = trainX
samplesLabels = trainY
print("Compiling neural network model...")
Model = Sequential()
Model.add(LSTM(input_shape = (98,),input_dim=98, output_dim=128, return_sequences=True))
Model.add(Dropout(0.2))
#Model.add(LSTM(128, return_sequences=True))
#Model.add(Dropout(0.2))
Model.add(TimeDistributedDense(7))
#rmsprop = rmsprop(lr=0.0, decay=0.0)
Model.compile(loss='mean_squared_error', optimizer='rmsprop')
Model.summary()
print("Training model...")
# learning schedule callback
#lrate = LearningRateScheduler(step_decay)
#callbacks_list = [lrate]
history = Model.fit(samplesData, samplesLabels, batch_size=batchSize, nb_epoch= epochs, verbose=1,
validation_split=0.2, show_accuracy=True)
print("model training has been completed.")
任何其他有關學習率,衰減等技巧。讚賞。