知识卡片
二类概率线性换算不是情感回归
将正面概率p写成8p−4,只是把分类信心映射到−4至4范围,模型并未学习原连续情感分值的条件期望。其MAE可作为该启发式的误差,不宜当已训练连续情感回归;预测概率列还需按classes_确认类别。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
- · 思维的词元
原书出处 · 1 处
- · 查看原书依据
>>> nb = nb.fit(df_movies, movies.sentiment > 0) #1 >>> movies['pred_senti'] = ( ... nb.predict_proba(df_movies))[:, 1] * 8 - 4 #2 >>> movies['error'] = movies.pred_senti - movies.sentiment >>> mae = movies['error'].abs().mean().round(1) #3 >>> mae 1.9 #1 Naive Bayes models are classifiers, so you need to convert your output variable (sentiment float) to a discrete label (integer, string, or bool). #2 Converts your discrete classification variable back
参考来源
- 位置:《Natural Language Processing in Action, Second Edition》第02章《思维的词元》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Natural Language Processing in Action, Second Edition/_epub-src/OEBPS/Text/chapter-2.html)
- 结论依据:摘录中关于二类概率线性换算不是情感回归的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:>>> nb = nb.fit(df_movies, movies.sentiment > 0) #1 >>> movies['pred_senti'] = ( ... nb.predict_proba(df_movies))[:, 1] * 8 - 4 #2 >>> movies['error'] = movies.pred_senti - movies.sentiment >>> mae = movies['error'].abs().mean().round(1) #3 >>> mae 1.9 #1 Naive Bayes models are classifiers, so you need to convert your output variable (sentiment float) to a discrete label (integer, string, or bool). #2 Converts your discrete classification variable back