- Web application that combines markdown, math equations, code, visualizations
- Go to AWS Marketplace and select
Deep Learning AMI (Ubuntu) Version 8.0
- ssh into the instance using the pem file
ssh -i "pemfile.pem" ubuntu@ec2-1-2-3-4-5.compute-1.amazonaws.com
- Source the tensorflow environement
source activate tensorflow_p36
- Generate a Jupyter Notebook config file
jupyter notebook --generate-config
- Set a password for the notebook
jupyter notebook password
- Start the Jupyter Notebook
jupyter notebook --ip=0.0.0.0 --no-browser
- Launch the notebook server
jupyter notebook
- Launch the notebook server on AWS server
jupyter notebook --ip=0.0.0.0 --no-browser
- Install Notebook Conda to help manage environments
conda install nb_conda
- List running servers with their tokens
jupyter notebook list
- Setup a Jupyter Notebook Password
jupyter notebook password
- It brings up a little pannel where commands can be searched
- Edit Mode: Type into cells
- Left border is green
- Command Mode: Execute commands
- Left border is blue
Enter/Esc
: Switch between edit/command modesEnter + Shift
: Go to next cellh
: List of shortcutss
: Save notebooka
: Create cell aboveb
: Create cell belowdd
: Delete celly
: Change from markdown to codem
: Change from code to markdownp
: Access the command palette
- cf markdow.md
- Math expressions using LaTeX symbols
- Notebooks use MathJax to render the LaTeX symbols as math symbols
- Special commands that lets you control the notebook itself, perform system calls
%
: Line Magic%%
: Cell Magic
Make autocomplete work again in Jupyter Notebooks - https://stackoverflow.com/a/64554305/791795
%config Completer.use_jedi = False
- List of all magic commands
- Timing Code
- Function call:
%timeit f(*args)
- Entire Cell:
%%timeit ...
- Function call:
- Embedding visualizations in notebooks:
%matplotlib
- Inline:
%matplotlib inline
- High quality:
%config InlineBackend.figure_format = 'retina'
- Inline:
%matplotlib inline
%config InlineBackend.figure_format = 'retina'
import numpy as np
...
plt.plot()
- Debugging in Notebooks:
%pdb
- When an error occurs, variables, scopes can be inspected
- pdb Documentation
- pdb commands
- Documentation: Prefix the method by
?
?str.replace()
- Time a cell
%%time
- Default, big JSON files with
.ipynb
extension - Convert to HTML file
jupyter nbconvert --to html notebook.ipynb
- Example
- Regular notebooks, designate which cells are slides and the type of the slide cell
- Export to slideshow
jupyter nbconvert notebook.ipynb --to slides
- Serve the presentation
jupyter nbconvert notebook.ipynb --to slides --post serve