且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Keras损失极高

更新时间:2023-12-02 15:39:46

正如@ Yu-Yang所说,您正在使用均方误差作为损失函数.在损失值将非常大之前,我遇到了同样的问题,将损失函数更改为 mean_squared_logarithmic_error 时,我得到了预期的结果.

As @Yu-Yang said you are using mean squared error as loss function. I had this same problem before where the loss value will be very large, on changing the loss function to mean_squared_logarithmic_error, I got the desired result.

model %>% compile(
optimizer = optimizer_rmsprop(lr=0.0001),
loss = loss_mean_squared_logarithmic_error,
metrics = c("accuracy")
)

损失值更改为

史诗1/10
326981/326981 [==============================]-17s-损失:0.0048-acc:0.9896

Epoch 1/10
326981/326981 [==============================] - 17s - loss: 0.0048 - acc: 0.9896

希望这对您有用!