mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-02-25 14:01:29 -05:00
42 lines
2.2 KiB
Markdown
42 lines
2.2 KiB
Markdown
---
|
||
id: 5e46f8edac417301a38fb931
|
||
title: 神经网络短信文本分类器
|
||
challengeType: 10
|
||
forumTopicId: 462380
|
||
dashedName: neural-network-sms-text-classifier
|
||
---
|
||
|
||
# --description--
|
||
|
||
你将<a href="https://colab.research.google.com/github/freeCodeCamp/boilerplate-neural-network-sms-text-classifier/blob/master/fcc_sms_text_classification.ipynb" target="_blank" rel="noopener noreferrer nofollow">使用 Google Colaboratory 来完成这个项目</a>。
|
||
|
||
进入该链接后,在你自己的账户或本地创建一个笔记本的副本。 一旦你完成项目并通过测试(包括在该链接),请在下面提交你的项目链接。 如果你提交的是 Google Colaboratory 的链接,请确保打开链接共享时选择 “anyone with the link”。
|
||
|
||
我们仍在开发机器学习课程的交互式课程部分。 现在,你可以通过这个认证中的视频挑战。 你可能还需要寻找额外的学习资源,类似于你在真实世界项目中的工作。
|
||
|
||
# --instructions--
|
||
|
||
在这个挑战中,你需要创建一个机器学习模型,将短信分类为 “ham” 或 “spam”。 “ham” 消息是朋友发送的正常消息。 “spam” 是一个公司发送的广告或信息。
|
||
|
||
你应该创建一个名为 `predict_message` 的函数,该函数接收一个消息字符串作为参数并返回一个列表。 列表中的第一个元素应该是一个介于 0 和 1 之间的数字,表示 “ham”(0)或 “spam”(1)的可能性。 列表中的第二个元素应该是单词 “ham” 或 “spam”,这取决于哪个最有可能。
|
||
|
||
对于这个挑战,你将使用 <a href="http://www.dt.fee.unicamp.br/~tiago/smsspamcollection/" target="_blank" rel="noopener noreferrer nofollow">SMS Spam Collection 数据集</a>。 数据集已经被分组为训练数据和测试数据。
|
||
|
||
前两个单元导入库和数据。 最后一个单元测试你的模型和功能。 在这些单元格之间添加你的代码。
|
||
|
||
# --hints--
|
||
|
||
它应该通过所有的 Python 测试。
|
||
|
||
```js
|
||
|
||
```
|
||
|
||
# --solutions--
|
||
|
||
```py
|
||
# Python challenges don't need solutions,
|
||
# because they would need to be tested against a full working project.
|
||
# Please check our contributing guidelines to learn more.
|
||
```
|