CMPUT 267 (Winter 2023)

Basics of Machine Learning

Instructions

In this markdown file we will go over installing julia, working with pluto, and starting the first assignment. A step-by-step video tutorial on installing Julia and Pluto Notebooks can be found here.

Installing Julia

In this course, we will be using julia v1.8.x for grading and highly recommend you install this version.

To install Julia v1.8.x go to the dowload page. If 1.8.x is not here, you can go to the the older releases page. You can install the latest point release of Julia 1.8.x. For more information about adding julia to PATH, see the platform specific instructions page.

Once installed and running, you will see a prompt

julia> 

To see your current directory, you can type pwd(). To change to a particular directory, say assignments, you use cd("assignments"). To leave julia, you type exit(). If you start julia from within a given directory, then that will be its current directory.

Installing Pluto Notebooks.

The code in this course will be completed in Pluto Notebooks. This is a julia grown alternative to Jupyter and offers an interesting perspective on what it means to write scientific notebooks. Installing this package is quite easy, after you start julia using julia just type in ]add Pluto@0.19. Note the ] character, this switches the julia repl to the pkg manager. We will discuss this in more detail later, but for now you only need to use the base environment. The @0.19 will make sure Pluto v0.19 is installed. This is the supported version of Pluto in this course. Note that you have to type ‘]’ first and can then paste add Pluto@0.19. To leave package mode, you can hit Backspace or ctrl-c.

Running a Pluto Notebook

You should have downloaded the A1.jl notebook. This is the notebook for the first assignment. To run this notebook from the Julia repl:

julia> import Pluto; Pluto.run(notebook="A1.jl")

Which will start a pluto server and begin starting to run the notebook. The first time the notebook is run expect it to take some time as several packages are being downloaded and installed. You can see the progress in Pluto. After the first run, these packages will be installed and re-starting the notebook should be much faster.

You can also start a generic pluto server by

julia> import Pluto; Pluto.run()

which will bring you to a homepage with your most recent notebooks listed. You can also do ?Pluto.run in the julia repl for more information and documentation. You can also use this convenient alias if you use zsh (with simple ports to other shells not provided here).

alias pluto="julia_run_version $@ -e \"using Revise; import Pluto; Pluto.run()\""

To exit from Pluto, back into julia, again you can hit Backspace or ctrl-c.