当前位置:网站首页>Tensorflow2.0 混淆矩阵与打印准确率不符
Tensorflow2.0 混淆矩阵与打印准确率不符
2022-07-30 18:59:00 【赫凯】
最近在做一个二分类的项目,模型最后几层是这样的,最后用了sigmiod激活。
model.add(tf.keras.layers.Dense(64, activation='relu'))
model.add(tf.keras.layers.Dropout(0.5)),
model.add(tf.keras.layers.Dense(1, activation='sigmoid'))
损失函数用了这个
tf.keras.losses.binary_crossentropy
跑起来就是
model.fit(
...
)
打印的信息效果还不错,最后我又用混淆矩阵看了一眼,吐了,完全不对,调了一整天,最后终于发现,预测出来的是概率。这么写,用y_pred
就OK啦。
pred = self.model.predict(x)
y_pred = (pred>0.5).astype(int)
边栏推荐
猜你喜欢
谷歌AlphaFold近日宣称预测出地球上几乎所有蛋白质结构
- daily a LeetCode 】 【 191. A number of 1
LeetCode Exercise - Two Questions About Finding Sum of Array Elements
A senior with 13 years of experience in software testing, summed up 5 test employment suggestions....
Delay queue optimization (2)
浅聊对比学习(Contrastive Learning)第一弹
固定资产可视化智能管理系统
[Prometheus] An optimization record of the Prometheus federation [continued]
【Prometheus】Prometheus联邦的一次优化记录[续]
Read the "Language Model" in one article
随机推荐
ctf.show_web5
二分答案裸题(加一点鸽巢原理)
SimpleOSS第三方库libcurl与引擎libcurl错误解决方法
Spark学习:用spark实现ETL
DM8:单库单实例搭建本地数据守护服务
The large-scale application of artificial intelligence AI products in industrial-grade mature shipping ports of CIMC World Lianda will create a new generation of high-efficiency smart ports and innova
Graphic LeetCode -- 11. Containers of most water (difficulty: medium)
MongoDB打破了原则引入SQL?
[Summary] 1396- 60+ VSCode plugins to create a useful editor
OneFlow源码解析:Op、Kernel与解释器
AI Basics: Graphical Transformer
延时队列优化 (2)
OSPF详解(4)
[Use of Qt Designer tool]
scrapy基本使用
LeetCode 练习——关于查找数组元素之和的两道题
【Swords Offer】Swords Offer 17. Print n digits from 1 to the largest
7.30模拟赛总结
一文读懂“语言模型”
Recommended Books | Recommend 3 database books with rave reviews