> [!NOTE]
> 本文档由 WeHub 基于上游 README 翻译整理,属于社区翻译,非官方中文文档。
> [English](./README.en.md) · [原始项目](https://github.com/ageron/handson-ml3) · [上游 README](https://github.com/ageron/handson-ml3/blob/HEAD/README.md)
> 原作者、版权与许可证归属以原始项目及本仓库 LICENSE 文件为准。
机器学习 Notebook,第 3 版
=================================
本项目旨在教你使用 Python 掌握机器学习(Machine Learning)的基础知识。其中包含示例代码,以及我 O'Reilly 著作 [Hands-on Machine Learning with Scikit-Learn, Keras and TensorFlow(第 3 版)](https://homl.info/er3): 第三版练习题的解答。
**注意**:如果你在找第二版的 notebook,请查看 [ageron/handson-ml2](https://github.com/ageron/handson-ml2). 第一版请见 [ageron/handson-ml](https://github.com/ageron/handson-ml).
## 快速开始
### 想在线使用这些 notebook,而无需安装任何东西?
*
(推荐)
⚠ _Colab 提供的是临时环境:你做的任何操作都会在一段时间后消失,因此请务必下载你关心的数据。_
其他服务也可能可用,但我尚未充分测试:
*
*
*
### 只想快速浏览一些 notebook,而不执行任何代码?
*
* [github.com 的 notebook 查看器](https://github.com/ageron/handson-ml3/blob/main/index.ipynb) 也能用,但并不理想:速度较慢,数学公式不一定能正确显示,而且较大的 notebook 经常打不开。
### 想用 Docker 镜像运行本项目?
阅读 [Docker 说明](https://github.com/ageron/handson-ml3/tree/main/docker).
### 想在自己的机器上安装本项目?
首先安装 [Anaconda](https://www.anaconda.com/products/distribution)(或 [Miniconda](https://docs.conda.io/en/latest/miniconda.html)), [git](https://git-scm.com/downloads),;如果你有兼容 TensorFlow 的 GPU,还需安装 [GPU 驱动](https://www.nvidia.com/Download/index.aspx), 以及相应版本的 CUDA 和 cuDNN(更多细节请参阅 TensorFlow 文档)。
接下来,打开终端并输入以下命令来克隆本项目(不要输入每行开头的 `$` 符号,它们只是表示这些是终端命令):
$ git clone https://github.com/ageron/handson-ml3.git
$ cd handson-ml3
然后运行以下命令:
$ conda env create -f environment.yml
$ conda activate homl3
$ python -m ipykernel install --user --name=python3
最后,启动 Jupyter:
$ jupyter notebook
如需更多说明,请阅读[详细安装说明](INSTALL.md)。
# 常见问题
**我应该使用哪个 Python 版本?**
我推荐 Python 3.10。如果你按照上述安装说明操作,就会得到该版本。任何 ≥3.7 的版本应该也都可以。
**调用 `load_housing_data()` 时出现错误**
如果出现 HTTP 错误,请确保你运行的代码与 notebook 中完全一致(如有需要请复制/粘贴)。如果问题仍然存在,请检查你的网络配置。如果是 SSL 错误,请参阅下一个问题。
**在 MacOSX 上出现 SSL 错误**
你可能需要安装 SSL 证书(参见这个 [StackOverflow 问题](https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error)). 如果你从官网下载了 Python,请在终端中运行 `/Applications/Python\ 3.10/Install\ Certificates.command`(将 `3.10` 改为你安装的版本)。如果你使用 MacPorts 安装 Python,请在终端中运行 `sudo port install curl-ca-bundle`。
**我已在本地安装了本项目。如何更新到最新版本?**
请参阅 [INSTALL.md](INSTALL.md)
**使用 Anaconda 时,如何将 Python 库更新到最新版本?**
请参阅 [INSTALL.md](INSTALL.md)
## 贡献者
我要感谢所有[为本项目做出贡献的人](https://github.com/ageron/handson-ml3/graphs/contributors),,无论是提供有用的反馈、提交 issue,还是提交 Pull Request。特别感谢 Haesun Park 和 Ian Beauregard,他们审阅了每一个 notebook 并提交了许多 PR,包括在部分练习解答上提供的帮助。还要感谢 Steven Bunkley 和 Ziembla 创建了 `docker` 目录,以及 GitHub 用户 SuperYorio 对部分练习解答的帮助。非常感谢 Victor Khaustov 提交了大量出色的 PR,修复了许多错误。最后,感谢 Google ML Developer Programs 团队通过提供 Google Cloud Credit 支持了这项工作。