AI-For-Beginners

教程

microsoft/AI-For-Beginners

面向初学者的 12 周 AI 课程,包含实验和测验。

项目简介

为期 12 周、24 课时的 AI 入门课程,涵盖神经网络、计算机视觉、自然语言处理和伦理等基础知识,使用 TensorFlow 和 PyTorch,包含实践实验和测验,支持多种语言。

README 预览

[](https://github.com/microsoft/AI-For-Beginners/blob/main/LICENSE)\n[](https://GitHub.com/microsoft/AI-For-Beginners/graphs/contributors/)\n[](https://GitHub.com/microsoft/AI-For-Beginners/issues/)\n[](https://GitHub.com/microsoft/AI-For-Beginners/pulls/)\n[](http://makeapullrequest.com)\n\n[](https://GitHub.com/microsoft/AI-For-Beginners/watchers/)\n[](https://GitHub.com/microsoft/AI-For-Beginners/network/)\n[](https://GitHub.com/microsoft/AI-For-Beginners/stargazers/)\n[](https://mybinder.org/v2/gh/microsoft/ai-for-beginners/HEAD)\n[](https://gitter.im/Microsoft/ai-for-beginners?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)\n\n[](https://discord.gg/nTYy5BXMWG)\n\n# Artificial Intelligence for Beginners - A Curriculum\n\n||\n|:---:|\n| AI For Beginners - _Sketchnote by [@girlie_mac](https://twitter.com/girlie_mac)_ |\n\nExplore the world of **Artificial Intelligence** (AI) with our 12-week, 24-lesson curriculum!  It includes practical lessons, quizzes, and labs. The curriculum is beginner-friendly and covers tools like TensorFlow and PyTorch, as well as ethics in AI\n\n\n### 🌐 Multi-Language Support\n\n#### Supported via GitHub Action (Automated & Always Up-to-Date)\n\n\n[Arabic](./translations/ar/README.md) | [Bengali](./translations/bn/README.md) | [Bulgarian](./translations/bg/README.md) | [Burmese (Myanmar)](./translations/my/README.md) | [Chinese (Simplified)](./translations/zh-CN/README.md) | [Chinese (Traditional, Hong Kong)](./translations/zh-HK/README.md) | [Chinese (Traditional, Macau)](./translations/zh-MO/README.md) | [Chinese (Traditional, Taiwan)](./translations/zh-TW/README.md) | [Croatian](./translations/hr/README.md) | [Czech](./translations/cs/README.md) | [Danish](./translations/da/README.md) | [Dutch](./translations/nl/README.md) | [Estonian](./translations/et/README.md) | [Finnish](./translations/fi/README.md) | [French](./translations/fr/README.md) | [German](./translations/de/README.md) | [Greek](./translations/el/README.md) | [H

常见问题 (5)

故障排除
如何修复在绘制正样本和负样本时出现的 matplotlib "TypeError: Axes.plot() got an unexpected keyword argument 's'" 错误?

plot() 不支持散点大小参数 s。请将 ax.plot() 替换为 ax.scatter(),并使用 c 指定颜色:

ax1.scatter(pos_examples[:, 0], pos_examples[:, 1],
            c='blue', marker='o', label='Positive', s=100, alpha=0.6)
ax1.scatter(neg_examples[:, 0], neg_examples[:, 1],
            c='red', marker='o', label='Negative', s=100, alpha=0.6)

不要在 scatter() 中使用 'bo'/'ro' 格式字符串;请改用 c='blue' 和 c='red'。

来源 Issue #726
故障排除
为什么泰米尔语翻译中显示了印地语单词?我该如何修复这个问题?

这是由于在泰米尔语语言环境下提交了残留的机器翻译印地语(天城文)文本所致。请使用 rg '[\x{0900}-\x{097F}]' translations/ta/ 审查泰米尔语文件,根据英文源文本将每一处印地语片段替换为正确的泰米尔语对应内容;如果 translations/ta/README.md 包含印地语部分,请将其恢复。该修复由 PR “fix(translations): replace residual Hindi words in Tamil lessons” 和 “fix: restore Tamil README translation”(Fixes #734)覆盖。作为临时解决方案,请使用英文版本,或手动从受影响的泰米尔语 Markdown 文件中删除天城文文本。

来源 Issue #734
故障排除
如何修复 Python 图像验证中会捕获 SystemExit 和 KeyboardInterrupt 的裸 except 子句?

将每个裸 except: 替换为 except Exception:,从而只捕获普通的应用程序异常,而让系统级异常继续传播。更新以下四个文件:

- lessons/4-ComputerVision/07-ConvNets/tfcv.py(第 51 行)
- lessons/4-ComputerVision/07-ConvNets/pytorchcv.py(第 137 行)
- lessons/4-ComputerVision/08-TransferLearning/tfcv.py(第 51 行)
- lessons/4-ComputerVision/08-TransferLearning/pytorchcv.py(第 137 行)

修复示例:

def check_image(fn):
    try:
        im = Image.open(fn)
        im.verify()
        return True
    except Exception:
        return False

这遵循 PEP 8 规范,并可防止 KeyboardInterrupt、SystemExit 及其他关键异常被静默掩盖。

来源 Issue #707
故障排除
如何修复 OwnFramework 反向传播课程中错误的 delta p 公式?

公式应使用偏导数的链式法则,而不是损失的有限变化量。如果 p 是参数,z 是层输出,L 是损失,则使用:

∂L/∂p = ∂L/∂z · ∂z/∂p

其中,∂L/∂z 是来自下一层的上游梯度,∂z/∂p 是局部梯度。不要乘以 ΔL(即损失的实际变化量),也不要将有限的损失变化当作梯度。

对于线性层 z = Wx + b,梯度为:

∂L/∂W = ∂L/∂z · xᵀ
∂L/∂b = ∂L/∂z
∂L/∂x = Wᵀ · ∂L/∂z

优化器的更新步骤应单独表示:

p_new = p - learning_rate · ∂L/∂p

请拉取最新版本的 OwnFramework.ipynb,或将错误的 δp 公式替换为上述链式法则表达式。更正后的 notebook 还修复了 obtanes 的拼写错误,并统一使用了 p 和 z 的偏导数符号。

来源 Issue #730
故障排除
如何修复 README 中泰米尔语翻译显示为印地语文本的问题?

该问题是由泰米尔语(ta)README 中包含印地语/天城文内容所导致的。已通过还原位于 translations/ta/README.md 的泰米尔语 README 进行修复。更新后,请验证该文件包含泰米尔文字且不含天城文字符;修复结果显示有 102 行泰米尔文字和 0 行天城文。请拉取最新更改或应用 PR fix(ta): restore Tamil translation in README。如仍有翻译问题,请在 https://github.com/Azure/co-op-translator 报告。

来源 Issue #706