Skip to main content

Introduction

The Jupyter Notebook is the default environment that machine learning practitioners, data scientists, and analysts use to code, experiment, and try things out. It provides an interactive computing environment where you can combine code execution, rich text, visualizations, and more.
By reading through and running the code in Jupyter notebooks on your device, you can see how machine learning code runs. You should complete them relatively quickly just by running it one line at a time from top to bottom.
From the documentation, you’ve seen supervised learning and unsupervised learning with examples of both. To more deeply understand these concepts, you’ll want to see, learn, and write code yourself to implement these concepts.

Why Jupyter Notebook?

Jupyter Notebook is the industry standard for machine learning development because it:

Interactive Development

Run code cell by cell and see immediate results

Rich Documentation

Combine code with markdown text, equations, and visualizations

Easy Sharing

Share notebooks with colleagues and the community

Visualization

Create and display plots and graphs inline

Installation Guide

Follow these steps to install Jupyter Notebook on your machine.
Prerequisites: You should have Python and PIP installed on your device before proceeding.
1

Install Jupyter Notebook

To install notebook, run the following command in your terminal:
pip install notebook
This will download and install Jupyter Notebook along with all its dependencies.
2

Launch Jupyter Notebook

To run the notebook server, use the following command:
jupyter notebook
This will start the Jupyter Notebook server and automatically open your default web browser to the notebook interface.
3

Verify Installation

After running the command, you should see the Jupyter Notebook interface in your browser at http://localhost:8888.
The terminal will show you the server status and any notebook activities. Keep the terminal running while you work with notebooks.

Understanding Jupyter Notebooks

Jupyter Notebooks are organized into cells, and there are two main types of cells you’ll work with:

Cell Types

Markdown cells contain text that describes the code. You can use markdown syntax to:
  • Add headings and subheadings
  • Format text with bold and italics
  • Create lists and tables
  • Include mathematical equations using LaTeX
  • Add links and images
These cells help you document your work and explain your thought process.
Code cells contain executable code. To run a code cell:
  1. Click on the cell to select it
  2. Press Shift + Enter to execute the code
  3. The output will appear directly below the cell
# Example code cell
import numpy as np
import matplotlib.pyplot as plt

# Create some sample data
x = np.linspace(0, 10, 100)
y = np.sin(x)

# Plot the data
plt.plot(x, y)
plt.title('Sine Wave')
plt.show()
Use Shift + Enter to run the current cell and move to the next one. Use Ctrl + Enter to run the cell and stay on it.
When you open a Jupyter Notebook, you’ll see several menus and options:
1

File Menu

Create new notebooks, open existing ones, save your work, and download notebooks in various formats.
2

Edit Menu

Cut, copy, paste, and manage cells in your notebook.
3

Cell Menu

Run cells, change cell types, and manage cell output.
4

Kernel Menu

Restart the kernel, interrupt execution, or change the kernel type.
Feel free to scroll up and down, browse, and mouseover the different menus to take a look at the different options. Experimenting with the interface is the best way to learn!

Getting Started with Your First Notebook

1

Create a New Notebook

Click on “New” in the top right corner and select “Python 3” to create a new notebook.
2

Write Your First Code

In the first cell, try running some simple Python code:
print("Hello, Machine Learning!")
Press Shift + Enter to execute the cell.
3

Add Documentation

Change the next cell to a Markdown cell and add some documentation:
## My First Machine Learning Notebook

This notebook will help me learn about ML concepts.
4

Import Libraries

Import common machine learning libraries:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import datasets

Downloading the Introductory Module

After installing the notebook, you can download our introductory Jupyter Notebook to get hands-on practice with machine learning concepts.

Download Introductory Module

Get the complete introductory notebook with examples and exercises from the GitHub repository
The introductory module includes:
  • Basic Python operations for machine learning
  • Working with NumPy arrays
  • Data visualization with Matplotlib
  • Simple machine learning examples
  • Hands-on exercises

Additional Resources

Official Jupyter Documentation

Learn more about Jupyter Notebook from the official docs

Installation Guide

Detailed installation instructions for different platforms

Keyboard Shortcuts

Here are some essential keyboard shortcuts to boost your productivity:
  • A - Insert cell above
  • B - Insert cell below
  • D, D - Delete selected cell
  • M - Change cell to Markdown
  • Y - Change cell to Code
  • Shift + Up/Down - Select multiple cells
  • Shift + Enter - Run cell and select below
  • Ctrl + Enter - Run cell
  • Alt + Enter - Run cell and insert below
  • Ctrl + / - Comment/uncomment lines

Best Practices

1

Document Your Work

Use Markdown cells to explain what your code does and why. This helps others (and future you) understand your thought process.
2

Keep Cells Small

Break your code into smaller, logical cells. This makes debugging easier and allows you to re-run specific parts without executing everything.
3

Save Regularly

Use Ctrl + S to save your notebook frequently. Jupyter also has an auto-save feature, but manual saves are recommended.
4

Restart and Run All

Before sharing or submitting a notebook, use “Kernel → Restart & Run All” to ensure your code runs correctly from top to bottom.

Congratulations!

You’ve successfully learned how to install and use Jupyter Notebook! Now you’re ready to start your machine learning journey with hands-on coding and experimentation.
Congrats on installing Jupyter Notebook on your device and going through the module. Now you know what Jupyter notebooks are and how to use them effectively!

What’s Next?

Introduction to Machine Learning

Learn the fundamentals of machine learning

Quick Start Guide

Get started with your ML learning journey

Supervised Learning

Dive into supervised learning algorithms

Code Examples

Explore practical ML examples in Jupyter notebooks

Build docs developers (and LLMs) love