f
Inputs
Outputs
In most cases, we will never be able to determine the exact function
ML: algorithms that approximate these complex, non-linear functions as well as possible, without manual intervention
What is ML?
Supervised
ML Algorithms
Unsupervised
Classification
Regression
Clustering
Dimensionality
⚠️ Overfitting and Underfitting
The standard pipline
Linear Regression
Usually has an analytical solution!
Supervised + Regression
Logistic Regression
Variant of linear regression for binary classification
Supervised + Classification
k-nearest neighbors
Supervised + Classification
k-nearest neighbors
Supervised + Regression
k-means clustering
Unsupervised + Classification
Decision Trees
Supervised + Regression/Classification
Random Forests
Supervised + Regression/Classification
✨ Ensemble ✨
Animal
With more data, the more an algorithm can expand its worldview
Animal
The Mother Algorithm
for supervised deep learning
Cost Model Intuition
Animals
Fruits
What is a simple cost model for this algorithm?
Cost Model Intuition
Animals
Fruits
for example:
Cost = N_errors / N_predictions
2/11 ~ 0.18
Cost Model Intuition
Animals
Fruits
ML ➡️ how do we reduce this cost as much as possible
✨optimization✨
f
Inputs
Outputs
Human brains are really good at doing these tasks, mainly due to our O(10^10) neurons
Now imagine a mathematical function with O(10^10) parameters....
671 billion Parameters
f
Inputs
Outputs
How do Neural Networks Learn?
💫 Calculus
💫 Partial derivatives
The Loss Function
The loss function is some function which tells us how poorly our outputs predicted compared to the true values
Also called the "Cost Function"
f
Inputs
Predicted
Outputs
True
Labels
Partial derivatives allow us to understand one single parameter of our model affects the Loss function
💫 Partial derivatives
671 billion Parameters
pick one
💫 Partial derivatives
✨ The partial derivative of our Loss function tells us exactly how to fine-tune each parameter
💫 Partial derivatives
✨ The partial derivative of our Loss function tells us exactly how to fine-tune each parameter
This process is called Gradient Descent
🤓 Let's go to the blackboard!
Time for live coding!
Notebook will appear on the Indico later.
Pytorch
Open source deep learning framework
✨ Nearly all of the functions we just coded by hand are included
Pytorch
Open source deep learning framework
✨ Nearly all of the functions we just coded by hand are included
Pytorch
PyTorch Lightning
One layer on top of PyTorch!!
uv add lightningValidation Dataset
Train Dataset
model learns patterns from it
Validation Dataset
judge model during training
Test Dataset
model is graded at the very end
Validation Dataset
Validation Dataset
judge model during training
From now on, let's try to also use validation datasets
Let's code with PyTorch!
Convolutional Neural Networks (CNN)
in a nutshell
Convolutional Neural Networks
A type of NN which specializes in computer vision
We want to extract new features from the images in a way that encodes spatial information as well
Convolutional Neural Networks
A type of NN which specializes in computer vision
We want to extract new features from the images in a way that encodes spatial information as well
✨ Dimensionality Reduction
Convolutional Neural Networks
A good recipe:
Example image
A cute 3x3 matrix
the convolution of the two
Convolutions
Convolutions
Act like filters on an image!
Convolutions
Then apply an activation function
to add non-linearity
Pooling
Pooling
Why?
Fully connected layers
The full picture
The full picture
Let's code!
The End