Keras Extremely High Loss

后端 未结 2 339
孤城傲影
孤城傲影 2021-01-18 07:03

I\'m trying to predict price by characteristics. I chose a pretty simple model, but it works very strange. Loss function is extremely high and I can\'t see where the problem

相关标签:
2条回答
  • 2021-01-18 07:14
    1. Normalize your dataset like preprocess step
    2. As I can see, you are using a regression model, so with a regression model your loss will be completely different from what it would be if you used the model for classification
    3. If you need classify. set the loss function in the likeness of categorical_crossentropy or another. And set activation func for last layer in your ml.

    Best regards!

    0 讨论(0)
  • 2021-01-18 07:19

    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")
    )
    

    The loss value changed to

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

    Hope this finds useful !

    0 讨论(0)
提交回复
热议问题