“预测"和“预测"之间有什么区别?和"predict_class"喀拉拉邦的功能? [英] What is the difference between "predict" and "predict_class" functions in keras?
问题描述
keras中的predict
和predict_class
函数之间有什么区别?
What is the difference between predict
and predict_class
functions in keras?
为什么Model
对象没有predict_class
功能?
推荐答案
predict
将返回回归的分数,而predict_class
将返回预测的类别.尽管看起来很相似,但还是有一些区别:
predict
will return the scores of the regression and predict_class
will return the class of your prediction. Although it seems similar there are some differences:
想象一下,您正在尝试预测图片是狗还是猫(您有分类器):
Imagine you are trying to predict if the picture is a dog or a cat (you have a classifier):
-
predict
将返回您:例如0.6只猫和0.2只狗. -
predict_class
会把你送回猫咪
predict
will return you: 0.6 cat and 0.2 dog (for example).predict_class
will return you cat
现在,您正在尝试预测房价(您有一个回归指标):
Now image you are trying to predict house prices (you have a regressor):
-
predict
将返回预测价格 -
predict_class
在这里没有意义,因为您没有分类器
predict
will return the predicted pricepredict_class
will not make sense here since you do not have a classifier
TL:DR:将predict_class
用于分类器(输出是标签),将predict
用于回归(输出是非离散的)
TL:DR: use predict_class
for classifiers (outputs are labels) and use predict
for regressions (outputs are non discrete)
希望有帮助!
这篇关于“预测"和“预测"之间有什么区别?和"predict_class"喀拉拉邦的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!