0Pricing
NLP Academy · 课时

解读模型的预测结果

解释类别概率

解读模型的预测结果 是 CoddyKit 上的免费 NLP Academy 课时。 这是第 4 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 NLP Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 NLP Academy 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

Beyond the Label

A model gives you more than a single answer. Learning to read its predictions tells you not just what it chose, but how confident it was.

The Hard Prediction

Calling predict returns the single most likely class for each input. This is the hard label, the model committing to one answer.

print(model.predict(X_new))

Probabilities Tell More

Use predict_proba to see the chance assigned to each class. A 0.95 spam score means far more conviction than a borderline 0.51.

print(model.predict_proba(X_new))

Rows Sum to One

Each row of probabilities adds up to exactly 1. The model splits all its belief across the available classes, never more and never less.

Know Your Class Order

Probability columns follow the order in classes_. Check that attribute so you know which column means spam and which means ham.

print(model.classes_)

Watch the Log Scale

Internally the model works in logs to avoid tiny numbers underflowing. The predict_log_proba method exposes those raw log scores if you need them.

Confidence Is Not Truth

A high probability means the model is sure, not that it is right. Naive Bayes can be overconfident, so treat its numbers with healthy caution.

Tune Your Threshold

You need not flag spam at 0.5. Raising the threshold to 0.8 means fewer false alarms but a few more spam messages slipping through.

spam_prob = model.predict_proba(X_new)[:, 1]
flag = spam_prob > 0.8

Inspect the Mistakes

Find inputs where the model was confident yet wrong. These errors often reveal missing words or labels that need fixing in your data.

Explain a Decision

For Naive Bayes you can list which words pushed a message toward spam. That word-level evidence makes the model pleasantly easy to explain. 🔎

From Numbers to Action

Probabilities let you sort by risk, route the unsure cases to a human, and set smart cutoffs. Reading them well turns a model into a real tool.

Quick Check

Which method reveals how confident the model is in each class?

Recap

You moved beyond hard labels to read probabilities, check class order, tune thresholds, and explain decisions. That is how you trust a classifier. ✅

常见问题解答

「解读模型的预测结果」课时是免费的吗?

是的 — 「解读模型的预测结果」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 NLP Academy 课程的其余内容,请升级到 CoddyKit PRO。 NLP Academy 课程共包含 4 节课。

「解读模型的预测结果」这节课中我会学到什么?

解释类别概率 你通过在浏览器中直接运行的动手代码来练习 NLP Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 NLP Academy 需要有经验吗?

无需任何先前经验。CoddyKit 上的 NLP Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 4 节课,共 4 节。

「解读模型的预测结果」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 NLP Academy 课中编写并运行代码吗?

能。每节 NLP Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 朴素贝叶斯背后的直觉
  2. 构建垃圾信息检测器
  3. 多项式模型与伯努利模型
  4. 解读模型的预测结果
← 返回 NLP Academy