image_class icon indicating copy to clipboard operation
image_class copied to clipboard

关于损失函数与评价函数的选择是否不匹配?

Open xuanwdx opened this issue 5 years ago • 3 comments

您好,模型的编译阶段代码:model.compile(loss="categorical_crossentropy", optimizer=adam, metrics=["accuracy"]) 。 损失函数选取了"categorical_crossentropy",而评价函数选取了"accuracy",个人查看了一下keras中文文档,觉得accuracy处也应该选取“categorical_accuracy''。 image 因为,文章中用了与"categorical_crossentropy"配合使用的“to_categorical''函数,将每个类别对应的真值label转化成了如上图所示 :其中向量只有一个索引为1,其余索引为0,对应一个类别。而网络预测结果最后以softmax作为输出。所以我认为应该用“categorical_accuracy'',请问您是怎么考虑的关于“accuracy‘’,现在keras中文文档没有它的官方说明......也是比较神奇

xuanwdx avatar Sep 28 '20 03:09 xuanwdx

你尝试改下试试

---原始邮件--- 发件人: "xuanwdx"<[email protected]> 发送时间: 2020年9月28日 11:18:08 收件人: "tslgithub/image_class"<[email protected]>; 抄送: "Subscribed"<[email protected]>; 主题: [tslgithub/image_class] 关于损失函数与评价函数的选择是否不匹配? (#27)

您好,模型的编译阶段代码:model.compile(loss="categorical_crossentropy", optimizer=adam, metrics=["accuracy"]) 。 损失函数选取了"categorical_crossentropy",而评价函数选取了"accuracy",个人查看了一下keras中文文档,觉得accuracy处也应该选取“categorical_accuracy''。

因为,文章中用了与"categorical_crossentropy"配合使用的“to_categorical''函数,将每个类别对应的真值label转化成了如上图所示 :其中向量只有一个索引为1,其余索引为0,对应一个类别。而网络预测结果最后以softmax作为输出。所以我认为应该用“categorical_accuracy'',请问您是怎么考虑的关于“accuracy‘’,现在keras中文文档没有它的官方说明......也是比较神奇

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

itismeJH avatar Sep 28 '20 03:09 itismeJH

要是验证对啦 麻烦跟我说一下哈,我来修正项目

---原始邮件--- 发件人: "xuanwdx"<[email protected]> 发送时间: 2020年9月28日 11:18:08 收件人: "tslgithub/image_class"<[email protected]>; 抄送: "Subscribed"<[email protected]>; 主题: [tslgithub/image_class] 关于损失函数与评价函数的选择是否不匹配? (#27)

您好,模型的编译阶段代码:model.compile(loss="categorical_crossentropy", optimizer=adam, metrics=["accuracy"]) 。 损失函数选取了"categorical_crossentropy",而评价函数选取了"accuracy",个人查看了一下keras中文文档,觉得accuracy处也应该选取“categorical_accuracy''。

因为,文章中用了与"categorical_crossentropy"配合使用的“to_categorical''函数,将每个类别对应的真值label转化成了如上图所示 :其中向量只有一个索引为1,其余索引为0,对应一个类别。而网络预测结果最后以softmax作为输出。所以我认为应该用“categorical_accuracy'',请问您是怎么考虑的关于“accuracy‘’,现在keras中文文档没有它的官方说明......也是比较神奇

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

itismeJH avatar Sep 28 '20 03:09 itismeJH

好,我有空的时候该一下,谢谢指导

tslgithub avatar Nov 20 '20 01:11 tslgithub