Fix writing errors

This commit is contained in:
Joe Bender 2020-04-20 14:27:40 -04:00
parent 67b917389e
commit dfae482ec6

View File

@ -12,16 +12,16 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# Appendix: Jupyter notebook 101" "# Appendix: Jupyter Notebook 101"
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"You can read this tutorial in the book, but we strongly suggest reading it in a (yes, you guessed it) Jupyter Notebook. This way, you will be able to actually *try* the different commands we will introduce here. If you followed one of our tutorial in the previous section, you should have been left in the course folder. Just click on `nbs` then `dl1` and you should find the tutorial named `00_notebook_tutorial`. Click on it to open a new tab and you'll be ready to go.\n", "You can read this tutorial in the book, but we strongly suggest reading it in a (yes, you guessed it) Jupyter Notebook. This way, you will be able to actually *try* the different commands we will introduce here. If you followed one of our tutorials in the previous section, you should have been left in the course folder. Just click on `nbs` then `dl1` and you should find the tutorial named `00_notebook_tutorial`. Click on it to open a new tab and you'll be ready to go.\n",
"\n", "\n",
"If you are on your personal machine, clone the course repository with and navigate inside before following the same steps.\n" "If you are on your personal machine, clone the course repository and navigate inside before following the same steps.\n"
] ]
}, },
{ {
@ -35,7 +35,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Let's build up from the basics, what is a Jupyter Notebook? Well, we wrote this book using jupyter notebooks. It is a document made of cells. You can write in some of them (markdown cells) or your can perform calculations in Python (code cells) and run them like this:" "Let's build up from the basics: what is a Jupyter Notebook? Well, we wrote this book using Jupyter Notebooks. A notebook is a document made of cells. You can write in some of them (markdown cells) or you can perform calculations in Python (code cells) and run them like this:"
] ]
}, },
{ {
@ -62,9 +62,9 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Cool huh? This combination of prose and code makes Jupyter Notebook ideal for experimentation: we can see the rationale for each experiment, the code, and the results in one comprehensive document. \n", "Cool, huh? This combination of prose and code makes Jupyter Notebook ideal for experimentation: we can see the rationale for each experiment, the code, and the results in one comprehensive document. \n",
"\n", "\n",
"Other renowned institutions in academy and industry use Jupyter Notebook, including Google, Microsoft, IBM, Bloomberg, Berkeley and NASA among others. Even Nobel-winning economists [use Jupyter Notebooks](https://paulromer.net/jupyter-mathematica-and-the-future-of-the-research-paper/) for their experiments and some suggest that Jupyter Notebooks will be the [new format for research papers](https://www.theatlantic.com/science/archive/2018/04/the-scientific-paper-is-obsolete/556676/).\n" "Other renowned institutions in academia and industry use Jupyter Notebook, including Google, Microsoft, IBM, Bloomberg, Berkeley and NASA among others. Even Nobel-winning economists [use Jupyter Notebooks](https://paulromer.net/jupyter-mathematica-and-the-future-of-the-research-paper/) for their experiments and some suggest that Jupyter Notebooks will be the [new format for research papers](https://www.theatlantic.com/science/archive/2018/04/the-scientific-paper-is-obsolete/556676/).\n"
] ]
}, },
{ {
@ -138,7 +138,7 @@
"\n", "\n",
"- Command Mode:: Allows you to edit the notebook as a whole and use keyboard shortcuts but not edit a cell's content. \n", "- Command Mode:: Allows you to edit the notebook as a whole and use keyboard shortcuts but not edit a cell's content. \n",
"\n", "\n",
"You can toggle between these two by either pressing <kbd>ESC</kbd> and <kbd>Enter</kbd> or clicking outside a cell or inside it (you need to double click if its a Markdown cell). You can always tell which mode you're on: the current cell will have a green border if in **Edit Mode** and a blue border in **Command Mode**. Try it!\n" "You can toggle between these two by either pressing <kbd>ESC</kbd> and <kbd>Enter</kbd> or clicking outside a cell or inside it (you need to double click if it's a Markdown cell). You can always tell which mode you're on: the current cell will have a green border in **Edit Mode** and a blue border in **Command Mode**. Try it!\n"
] ]
}, },
{ {
@ -156,13 +156,13 @@
"\n", "\n",
"![Save](images/chapter1_save.png)\n", "![Save](images/chapter1_save.png)\n",
"\n", "\n",
"To know if your *kernel* (the python engine executing your instructions behind the scene) is computing or not you can check the dot in your upper right corner. If the dot is full, it means that the kernel is working. If not, it is idle. You can place the mouse on it and the state of the kernel will be displayed.\n", "To know if your *kernel* (the Python engine executing your instructions behind the scenes) is computing or not, you can check the dot in your upper right corner. If the dot is full, it means that the kernel is working. If not, it is idle. You can place the mouse on it and the state of the kernel will be displayed.\n",
"\n", "\n",
"![Busy](images/chapter1_busy.png)\n", "![Busy](images/chapter1_busy.png)\n",
"\n", "\n",
"There are a couple of shortcuts you must know about which we use **all** the time (always in **Command Mode**). These are:\n", "There are a couple of shortcuts you must know about which we use **all** the time (always in **Command Mode**). These are:\n",
"\n", "\n",
" - Shift+Enter:: Runs the code or markdown on a cell\n", " - Shift+Enter:: Run the code or markdown on a cell\n",
" \n", " \n",
" - Up Arrow+Down Arrow:: Toggle across cells\n", " - Up Arrow+Down Arrow:: Toggle across cells\n",
" \n", " \n",
@ -172,7 +172,7 @@
"\n", "\n",
"You can find more shortcuts by typing <kbd>h</kbd> (for help).\n", "You can find more shortcuts by typing <kbd>h</kbd> (for help).\n",
"\n", "\n",
"You may need to use a terminal in a Jupyter Notebook environment (for example to git pull on a repository). That is very easy to do, just press 'New' in your Home directory and 'Terminal'. Don't know how to use the Terminal? We made a tutorial for that as well. You can find it [here](https://course.fast.ai/terminal_tutorial.html).\n", "You may need to use a terminal in a Jupyter Notebook environment (for example to git pull on a repository). That is very easy to do: just press 'New' in your Home directory and 'Terminal'. Don't know how to use the Terminal? We made a tutorial for that as well. You can find it [here](https://course.fast.ai/terminal_tutorial.html).\n",
"\n", "\n",
"![Terminal](images/chapter1_terminal.png)" "![Terminal](images/chapter1_terminal.png)"
] ]
@ -188,7 +188,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Markdown formatting\n" "## Markdown Formatting\n"
] ]
}, },
{ {
@ -353,7 +353,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"We can also print images while experimenting. I am watching you." "We can also print images while experimenting."
] ]
}, },
{ {
@ -381,7 +381,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Running the app locally" "## Running the App Locally"
] ]
}, },
{ {
@ -399,14 +399,14 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Creating a notebook" "## Creating a Notebook"
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"Now that you have your own jupyter notebook running, you will probably want to write your owns. Click on 'New' in the upper left corner and 'Python 3' in the drop-down list (we are going to use a [Python kernel](https://github.com/ipython/ipython) for all our experiments).\n", "Now that you have your own Jupyter Notebook server running, you will probably want to write your own notebook. Click on 'New' in the upper left corner and 'Python 3' in the drop-down list (we are going to use a [Python kernel](https://github.com/ipython/ipython) for all our experiments).\n",
"\n", "\n",
"![new_notebook](images/chapter1_new_notebook.png)\n" "![new_notebook](images/chapter1_new_notebook.png)\n"
] ]
@ -415,7 +415,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"## Shortcuts and tricks" "## Shortcuts and Tricks"
] ]
}, },
{ {
@ -436,23 +436,23 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"There are a couple of useful keyboard shortcuts in `Command Mode` that you can leverage to make Jupyter Notebook faster to use. Remember that to switch back and forth between `Command Mode` and `Edit Mode` with <kbd>Esc</kbd> and <kbd>Enter</kbd>.\n", "There are a couple of useful keyboard shortcuts in `Command Mode` that you can leverage to make Jupyter Notebook faster to use. Remember that you can switch back and forth between `Command Mode` and `Edit Mode` with <kbd>Esc</kbd> and <kbd>Enter</kbd>.\n",
"\n", "\n",
"- m:: Convert cell to Markdown\n", "- m:: Convert cell to Markdown\n",
"\n", "\n",
"- y:: Convert cell to Code\n", "- y:: Convert cell to Code\n",
"\n", "\n",
"- D+D:: Delete cell\n", "- d+d:: Delete cell\n",
"\n", "\n",
"- o:: Toggle between hide or show output\n", "- o:: Toggle between hide or show output\n",
"\n", "\n",
"- Shift+Arrow up/Arrow down:: Selects multiple cells. Once you have selected them you can operate on them like a batch (run, copy, paste etc).\n", "- Shift+Arrow up/Arrow down:: Select multiple cells. Once you have selected them you can operate on them like a batch (run, copy, paste etc).\n",
"\n", "\n",
"- Shift+M:: Merge selected cells.\n", "- Shift+M:: Merge selected cells\n",
"\n", "\n",
"- Shift+Tab (press once):: Tells you which parameters to pass on a function \n", "- Shift+Tab (press once):: See which parameters to pass to a function \n",
"\n", "\n",
"- Shift+Tab (press three times):: Gives additional information on the method\n" "- Shift+Tab (press three times):: Get additional information on the method\n"
] ]
}, },
{ {
@ -489,7 +489,7 @@
"source": [ "source": [
"Line magics are functions that you can run on cells. They should be at the beginning of a line and take as an argument the rest of the line from where they are called. You call them by placing a '%' sign before the command. The most useful ones are:\n", "Line magics are functions that you can run on cells. They should be at the beginning of a line and take as an argument the rest of the line from where they are called. You call them by placing a '%' sign before the command. The most useful ones are:\n",
"\n", "\n",
"- `%matplotlib inline`:: This command ensures that all matplotlib plots will be plotted in the output cell within the notebook and will be kept in the notebook when saved.\n", "- `%matplotlib inline`:: Ensures that all matplotlib plots will be plotted in the output cell within the notebook and will be kept in the notebook when saved.\n",
"\n", "\n",
"This command is always called together at the beggining of every notebook of the fast.ai course.\n", "This command is always called together at the beggining of every notebook of the fast.ai course.\n",
"\n", "\n",
@ -497,7 +497,7 @@
"%matplotlib inline\n", "%matplotlib inline\n",
"```\n", "```\n",
"\n", "\n",
"- `%timeit`:: Runs a line a ten thousand times and displays the average time it took to run it." "- `%timeit`:: Runs a line ten thousand times and displays the average time it took to run."
] ]
}, },
{ {
@ -521,7 +521,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"`%debug`: Allows to inspect a function which is showing an error using the [Python debugger](https://docs.python.org/3/library/pdb.html). If you type this in a cell just after an error, you will be directed in a console where you can inspect the values of all the variables.\n" "`%debug`: Inspects a function which is showing an error using the [Python debugger](https://docs.python.org/3/library/pdb.html). If you type this in a cell just after an error, you will be directed to a console where you can inspect the values of all the variables.\n"
] ]
} }
], ],