Keras NN regression model gives low loss, and 0 acuracy

前端 未结 2 1993
慢半拍i
慢半拍i 2021-01-29 05:58

I am having a problem with this NN regression model in keras. I am working on a cars dataset to predict the price based on 13 dimensions. In short, I have read it as pandas data

相关标签:
2条回答
  • 2021-01-29 06:18

    First of all, you should consider clean your code when posting questions in stackoverflow. I've tried to replicate your code and found some errors before getting your dataset clean at numpy arrays train_data, train_targets, test_data and test_targets.

    Focusing on machine learning theory, if you don't shuffle your dataset, it is going to be really harder for you regression model to get trained. Try shuffling your dataset using random.shuffle() before splitting train and test subsets.

    As stated by Matias answer, if you are working on a regression problem (instead of a classification one) it makes no sense to use the accuracy metric.

    Furthermore, binary crossentropy loss is only suitable for classification too, so it neither makes sense. Typical loss used for regression models is Mean Square Error. Consider changing you keras model compiling by:

    model.compile(loss='mean_squared_error', optimizer='adam')
    

    Hope this helps!

    0 讨论(0)
  • 2021-01-29 06:31

    Accuracy is a classification metric, it makes no sense to use it for regression. There is no actual problem.

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