Zero accuracy training a neural network in Keras

前端 未结 5 622
别那么骄傲
别那么骄傲 2021-01-17 08:17

I train a Neural Network of Regression Problem in Keras. Why the output is only one Dimension, the accuracy in each Epoch always show acc: 0.0000e+00?

like this:

5条回答
  •  有刺的猬
    2021-01-17 09:21

    The problem is that your final model output has a linear activation, making the model a regression, not a classification problem. "Accuracy" is defined when the model classifies data correctly according to class, but "accuracy" is effectively not defined for a regression problem, due to its continuous property.

    Either get rid of accuracy as a metric and switch over to fully regression, or make your problem into a classification problem, using loss='categorical_crossentropy' and activation='softmax'.

    This is a similar problem to yours: Link

    For more information see: StackExchange

提交回复
热议问题