Basic Tutorials Part 4

Basic Tutorials Part 4

Imagem de capa

Jupyter Notebooks

Welcome to this tutorial, Part 4 of the series on using Jupyter notebooks.

As a seasoned practitioner, you might want to demonstrate your code. Your insights and the techniques used.

The notebook is a web application that allows you to combine explanatory text, math equations, code, and visualizations all in one easily sharable document.

Notebooks have quickly become an essential tool when working with data. You’ll find them being used for data cleaning and exploration, visualization, machine learning, and analysis.

These support one of my favourite philosophies of Literate programming. To qoute Donald Knuth

Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.

Working

Jupyter notebooks grew out of the IPython project started by Fernando Perez.

IPython is an interactive shell, similar to the normal Python shell but with great features like syntax highlighting and one of my favourite-code completion (For the note, I’m not lazy, I’m a relaxed typer)

The central point is the notebook server. You connect to the server through your browser and the notebook works as a web app. The code is sent through the server to the kernel. The kernel runs the code and sends it back to the server, then any output is rendered back in the browser.

The notebooks are saved as .ipynb files, in a JSON format.

Jupyter isn’t Python exclusive! The new name Jupyter comes from the combination of Julia, Python, and R. The basic working is the same for any given language. Just the kernel running everything in the background changes.

Note: Since the Notebooks do not have to be on the same machine, we will use to render notebooks on our machine while using a cloud vendor’s offering.

Installation:

conda install jupyter notebook

Launching a jupyter server:

When in the environment

jupyter notebook

You’ll see a little box outlined in green. This is called a cell. Cells are where you write and run your code.

Juputer also supports Markdown. In the toolbar, click “Code” to change it to Markdown and back. The little play button runs the cell, and the up and down arrows move cells up and down. Notice, the colour is now Blue.

Now there is a lot of things in the toolbar, feel free to play around a bit and familiarize yourself. Here are a few:

Cells:

To activate a cell, press enter when it is highlighted.

Shortcuts

Now, in my defence I’m not lazy, the touchpad is just too far down on Macbook. So here are a few commands that I think are common:

These will often become intuitive and you will find the faster rather than searching for these commands via the GUI

These are few of the shorcuts that are worthy of a quick mention. There many more mentioned in our Git Repo

To get a list of all commands,

Markdown cells:

Markdown is the widely used format to create web documents. This post is written in Markdown. So it’s worth to mention a few of the Syntaxes that are common.

You may want to leverage this when you create a notebook for showcasing your models/results.

# Heading
## Sub-heading
### Sub Sub heading

Heading

Sub-Heading

Sub Sub Heading

[Name](link)
![Title](Link)
**A Bold line**

A Bold line

*An italic line*

An italic line

_Underline this line_

Underline this line

This is a basic overview of the funtionalities offered by Jupyter notebooks, this is by no means an exhaustive list.

We encourage you to play around, get familiar with the interface and leave us a comment below if you want to discuss anything!

Subscribe to my weekly-ish [Newsletter](https://tinyletter.com/sanyambhutani/) for a set of curated Deep Learning reads