python - Keras 确定错误的预测
问题描述
我有一个训练有素的 Keras 模型,并且我有一个验证集(即 X_val、y_val)。我想使用模型来预测 y_val,然后确定错误预测的索引。然后,我将使用这些索引来确定与错误分类相对应的原始数据点。我如何获得这些指数?
我的目标是显示我们错误分类的原始输入列表。这是我的错误分析的一部分。原始输入是文本,但这不应该是相关的。
解决方案
I'd suggest to compare the prediction where it's incorrect using the model's predict_class.
incorrects = np.nonzero(model.predict_classes(X_val).reshape((-1,)) != y_val)
推荐阅读
- c - 如何在内联汇编中声明一个字符缓冲区?
- javascript - PHP - 为什么我从我的编码对象数组中得到奇怪的结果?
- java - JAVA Swing:无法将文本附加到 TextArea
- xslt - XSLT 匹配多个条件
- javascript - 在某些月份停止增加和减少月份
- python - 有没有一种 Pythonic 方式来交互两个数据帧并比较它们的行?
- python - 奇怪的结果形式 stats.mannwhitneyu
- excel - Excel/VBA 是否优化冗余变量?
- react-native - 如何在 React Native 中自动链接依赖项的依赖项?
- c# - 无法将运算符“> =”应用于 X 类型的运算符和“浮点”