Assignment 2 - Setup Jupyter

Assignment Objectives

  • Install Jupyter on your development machine

  • Learn how to run Jupyter Notebook Server locally

  • Get oriented with the basic features of Jupyter Notebooks

  • Import and run a notebook authored by Me

  • Export and submit a notebook authored by You!

Pre-Requisites

An environment with pythonarrow-up-right and piparrow-up-right installed. If you prefer a different package manager for installing python modules that's fine too but instructions for this course will use pip. Basic command line literacy is assumed. If any commands or questions seem unclear please reach out to wmcnichols@ccny.cuny.eduenvelope.

Install Jupyter

Run the following command from your terminal

$ pip install jupyterlab

Then create a directory for this course on your machine and navigate to it.

For example (in unix)

$ mkdir ~/Developer/cs59974
$ cd ~/Developer/cs59974
circle-info

You may not have a ~/Developer directory on your machine. Feel free to put your directory wherever you like.

Start a Jupyter notebook in the directory you just created by running the following command:

This command will automatically open a browser to localhost:8888/tree. When this command is run the server is ran locally and is reachable on a browser by the web address above. Jupyter is a deployable web service which makes it very portable for use with various cloud services.

circle-info

Note once you run jupyter notebook command your current terminal window will now become an occupied by a live console for jupyter. If you want to run further commands you will need to do so in another window. If you need to shut down your notebook you can do so by killing the process on the terminal window with ctrl + C

Portability is a big advantage because machine learning (and scientific computing in general) requires very heavy computational resources. For example, if you were to want to run your same code that you develop on your laptop on a machine with a very sophisticated/expensive GPU you could do so relatively easily.

If everything went as planned you should see an empty Jupyter Notebook as such:

Example of an empty Jupyter Notebook

Get comfortable

After you've got your server up and running it's time to start playing around! Follow the instructions on the following page to create your first notebook and learn some of the basics of the interface. This is the "Hello World" guide for Jupyter.

After completing the above tutorial you should have learned:

  • How to create a new notebook

  • How to insert/run code in a Jupyter notebook

  • How to insert and render markdown in a Jupyter notebook

Import and Run A Notebook

Behind the scenes notebooks authored in Jupyter are generated into a .ipynb file. These files can be extracted and shared with others who can then run these notebooks on their own Jupyter Server. There are many repositories of notebooks that you can experiment and play around with on your own. Here is a list of examples highlighted by the Jupyter organization.

Explore the above repository and find a notebook that interests you and read and play around with it. Once you've found one you like download the .ipynb file and corresponding dataset for the notebook and run it locally on your Jupyter Server. You will use

Build Your First Notebook

Now that you've gotten an idea of how Jupyter notebooks work it's time for you to make your own. You can either use the notebook that you made in the Get Comfortable section or make a fresh new one. From here, the sky is the limit! Make a brief notebook that shows off some cool python code. For some inspiration you could try using some of the libraries that you found in Import and Run A Notebook to create your own unique program. Or you could take some python code that you wrote in previous courses and present it here. The only requirements for this assignment are that you have a notebook that includes some python code that you wrote and some markdown that explains what it does. The best notebooks will have an opportunity to present next class.

Inclusion of at least one meme in your notebook will give you one arbitrary brownie point.

Submission instructions

Once you've finished making a notebook it's time to submit. For now, please place your .ipynb file and any dependencies (datasets, etc) into a zip file and email it to me at wmcnichols@ccny.cuny.eduenvelope. Note: I'm exploring other submission options for Notebooks. Future assignments will have different instructions for how to submit for a grade.

Last updated