Labs

Lab 0: Software Requirements

We use the Python programming language and the PyTorch library for machine learning. If you have not use either of these tools before, you need to install them. Please refer to the software installation instructions in this page. If you have never installed software packages before, do not give up just yet. This is straightforward.

To aid in learning we provide annotated solutions to each assignment using Jupyter Notebooks. If you haven’t used this tool before, you need to install it as well. Installation instructions are available in the same page. This is straightforward too.

Access Software Installation Instructions

Lab 1: Admissions to the University of Pennsylvania 

In this Lab we are tasked with designing a system to make admission decisions at the University of Pennsylvania (Penn). In order to design this system we need to acquire data and create a model to substantiate our decisions. For a collection of former students we have access to their high school (HS) grade point average (GPA), their Scholastic Assessment Test (SAT) scores, their gender and their Penn GPA. We decide to build an AI that mimics Penn GPA of admitted students. This AI takes as inputs high school GPA, SAT scores and gender, and produces as an output a prediction of the student’s Penn GPA.

Lab 1A: Data, Models, and Decisions (Day 1)

In this first part of the lab we visualize the data we are given and build a simple linear model. That is, we postulate that the Penn GPA of a student is a linear combination (a weighted sum) of their high school GPA and SAT scores. This AI makes predictions that are not too good, but it help us to introduce the three basic componnets of an AI system: Data, models, and decisions.

Access Lab Page.

Download Jupyter Notebook and Data.

Download Assignment.

Lab 1B: Gradient Descent and Stochastic Gradient Descent (Day 2)

In Lab 1A we postulated that Penn GPAs are linear combinations of high school GPA and SAT scores. We also utilized an optimization formulation to define the optimal coefficients of the corresponding weighted sum. The formulated problems were solved analytically by taking derivatives and setting them to zero. This is not possible in general. We need recursive numerical methods to find optimal coefficients. In this lab we introduce gradient descent and stochastic gradient descent. These are the workhorse algorithms of machine learning. The two algorithms whose use in finding optimal parameters of AI models is most widespread.

Access Lab Page.

Download Jupyter Notebook and Data.

Download Assignment.

Lab 1C: Neural Networks (Days 3 and 4)

Neural Networks (NNs) are information processing architectures made up of a composition of layers, each of which is itself the composition of a linear transformation with a pointwise nonlinearity. NNs are the most widespread technology used in AI models. This lab uses NNs to predict Penn GPA scores. We introduce the concepts of training and testing set.

Access Lab Page.

Download Jupyter Notebook and Data.

Download Assignment.

LAB 1X: Training Models with PyTorch

Gradient descent and stochastic gradient descent are finicky algorithms that require the computation of gradients (derivatives). Both are painful activities. It is painful to compute derivatives and it is painful to make a finicky algorithm work. The growing popularity of machine learning has led to the implementation of packages that automate the computation of derivatives and the implementation of stochastic gradient descent. In ESE 2000 we use the PyTorch package. Pytorch is a commercial product that I do not endorse. 

Learning to use a package is not part of the goals of this course. This is just a means to an end. This tutorial is an Appendix. We will not cover it in class, but I encourage you to read it. 

Access Tutorial Page.

Download Jupyter Notebook and Data.

Download Tutorial.

Lab 2: Signals in Time: Audio Processing and Classification

Audio is mathematically modeled as a function x(t) in which represents time and x(t) is an electric signal that is generated by transforming pressure waves with a microphone. The same pressure waves can be reconstructed from the electrical signal using a speaker. In this lab we want to use what we learned in Lab 1 to process audio. In particular, we want to clean up an audio signal (Labs 2A and 2B) and we want to recognize spoken words (Lab 2C).

Lab 2A: Audio Processing with Convolutions (Day 5)

Our goal is to remove an unwanted sound from a wanted sound. In the trade, we say that we want to remove noise from a signal. Given what we learned in Lab 1, we know how to do this. We gather data in the form of examples of contaminated and clean audio and we model the input/output relationship between the signal with noise and the signal without noise. Our decisions (the clean data) are the output of this model after we find optimal parameters with gradient descent.

This is what we will do, indeed. Except that the model here is not as easy as a matrix multiplication or a neural network. The reason for this is the large dimension of the input signal. We overcome the challenge of dimensionality using convolutions. Other than learning convolutions we will learn in this lab that building models is not straightforward. There are, in fact, a handful of models known to humanity that work in a handful of situations. These models are designing by exploiting our knowledge of the input and output signals. Convolutions, as we will see, leverage the locality of time.

Access Lab Page.

Download Jupyter Notebook.

Download Assignment.

Lab 2B: Convolutional Neural Networks in Time (Day 6)

Access Lab Page.

Download Jupyter Notebook.

Download Assignment.

Lab 2C: Classification of Spoken Digits (Days 7 and 8)

Access Lab Page

Download Jupyter Notebook.

Download data

• Download Assignment

Lab 3: Signals on Graphs: Movie Recommendation with Collaborative Filtering

Lab 3A: Graphs and Graph Convolutions (Day 9)

Access Lab Page

• Download Assignment

Lab 3B: Graph Neural Networks (Day 10)

Access Lab Page

• Download Assignment

Lab 4: Images

Lab 4A: Image Classification (Day 11)

Access Lab Page

Download Assignment

Lab 4B: Convolutional Neural Networks in Space (Day 12)

Acces Lab Page

• Download Assignment

Lab 5: Dynamical Systems

Lab 5A: Dynamical Systems (Day 13)

Acces Lab Page

• Download Assignment

Lab 5B: Closed Loop Control (Day 14)

Acces Lab Page

• Download Assignment