我想预测下雨的数量,但我没有提高 val_loss 和 loss 的值。
我试图更改优化器,学习率,层数,每个隐藏层中的神经元数,激活函数...数据已被标准化...
我读到这个问题是关于过度拟合的。。。但是我没有解决这个问题。
NN体系结构:
#define the keras model
model2 = Sequential()
model2.add(Dense(10, input_dim=37, activation="sigmoid"))
model2.add(Dense(1, activation="linear"))
# compile the keras model
model2.compile(loss="mse",
optimizer=RMSprop(lr=0.1))
#Early stopping
es2=EarlyStopping(monitor="val_loss",
verbose=1,
patience= 5)
# fit the keras model on the dataset
history2 = model2.fit(x_train,y_train,
validation_data=(x_test, y_test),
epochs=1000,
callbacks= [es2],
batch_size=10)
我在培训中获得的价值观:
Train on 4250 samples, validate on 750 samples
Epoch 1/1000
4250/4250 [==============================] - 3s 699us/step - loss: 28.7539 - val_loss: 55.4321
Epoch 2/1000
4250/4250 [==============================] - 1s 186us/step - loss: 28.9061 - val_loss: 54.4018
Epoch 3/1000
4250/4250 [==============================] - 1s 187us/step - loss: 28.0290 - val_loss: 51.9907
Epoch 4/1000
4250/4250 [==============================] - 1s 205us/step - loss: 26.4459 - val_loss: 45.6052
...
Epoch 22/1000
4250/4250 [==============================] - 1s 186us/step - loss: 21.3203 - val_loss: 44.9154
Epoch 23/1000
4250/4250 [==============================] - 1s 198us/step - loss: 21.6208 - val_loss: 45.0692
Epoch 24/1000
4250/4250 [==============================] - 1s 192us/step - loss: 21.6213 - val_loss: 41.8299
Epoch 00024: early stopping
我在 loss 和 val_loss 中达到了19和39的值,但效果却更好。
有人可以帮我吗? Thaaaaaanks!