0
点赞
收藏
分享

微信扫一扫

《人工智能-深度学习》图像识别中的卷积神经网络 - 模块0 准备 - IPython教程


0.3 IPython Tutorial IPython教程

(Note: some of the screenshots here may be out-of-date. However, this should still prove useful as a quick intro, and for the general menu layout, etc.) (注意:这里的一些截图可能已经过时了。但是,这仍然可以作为一个快速入门,以及一般的菜单布局,等等。

In this class, we will use IPython notebooks (more recently known as Jupyter notebooks【​​​https://jupyter.org/】​​​) for the programming assignments. An IPython notebook lets you write and execute Python code in your web browser. IPython notebooks make it very easy to tinker with code and execute it in bits and pieces; for this reason IPython notebooks are widely used in scientific computing. 在这个类中,我们将使用IPython notebooks (最近称为Jupyter notebooks)来完成编程任务。一个IPython notebooks允许您在web浏览器中编写和执行Python代码。IPython notebooks使修改代码变得非常容易,并以位和块来执行;因此,IPython notebooks在科学计算领域得到了广泛的应用。

(Note: if your virtual environment installed correctly (as per the assignment handouts), then you shouldn’t have to install from the install instructions on the website. Just remember to run source .env/bin/activate in your assignment folder.) (注:如果你的虚拟环境安装正确(根据作业讲义),那么你不应该安装在网站上的安装说明。记住要在你的任务文件夹中运行source .env/bin/激活。)

Once you have it installed, start it with this command: 安装好后,使用这个命令启动它:

jupyter notebook

Once your notebook server is running, point your web browser at ​​​http://localhost:8888​​​ to start using your notebooks. If everything worked correctly, you should see a screen like this, showing all available IPython notebooks in the current directory: 在你的笔记本服务器运行后,将你的web浏览器指向http://localhost:8888,开始使用你的笔记本。如果一切正常,您应该看到这样的屏幕,显示当前目录中所有可用的IPython notebook:

《人工智能-深度学习》图像识别中的卷积神经网络 - 模块0 准备 - IPython教程_ide

If you click through to a notebook file, you will see a screen like this:如果你点击一个笔记本文件,你会看到一个这样的屏幕:

《人工智能-深度学习》图像识别中的卷积神经网络 - 模块0 准备 - IPython教程_IPython教程_02

An IPython notebook is made up of a number of cells. Each cell can contain Python code. You can execute a cell by clicking on it and pressing Shift-Enter. When you do so, the code in the cell will run, and the output of the cell will be displayed beneath the cell. For example, after running the first cell the notebook looks like this: 一个IPython notebook由许多单元组成。每个单元格都可以包含Python代码。你可以通过单击它并按Shift-Enter来执行单元格。当你这样做时,单元中的代码将运行,单元格的输出将显示在单元格下面。例如,在运行第一个单元格之后,笔记本看起来是这样的:

《人工智能-深度学习》图像识别中的卷积神经网络 - 模块0 准备 - IPython教程_ide_03

Global variables are shared between cells. Executing the second cell thus gives the following result: 全局变量在单元格之间共享。因此,执行第二个单元格会得到以下结果:

《人工智能-深度学习》图像识别中的卷积神经网络 - 模块0 准备 - IPython教程_当前目录_04

By convention, IPython notebooks are expected to be run from top to bottom. Failing to execute some cells or executing cells out of order can result in errors: 按照惯例,IPython notebooks预计将从上到下运行。如果不执行某些单元格或执行单元格,可能会导致错误:

《人工智能-深度学习》图像识别中的卷积神经网络 - 模块0 准备 - IPython教程_python_05

After you have modified an IPython notebook for one of the assignments by modifying or executing some of its cells, remember to save your changes! 在通过修改或执行部分单元格修改了一个IPython notebook后,记住保存您的更改!

This has only been a brief introduction to IPython notebooks, but it should be enough to get you up and running on the assignments for this course.这仅仅是对IPython notebooks的简要介绍,但它应该足以让你完成这门课程的作业。

《人工智能-深度学习》图像识别中的卷积神经网络 - 模块0 准备 - IPython教程_python_06



举报

相关推荐

0 条评论