Supervised Learning Overview, Formulation, Train-Test Split: EE514 - CS535
Supervised Learning Overview, Formulation, Train-Test Split: EE514 - CS535
EE514 – CS535
Zubair Khalid
https://www.zubairkhalid.org/ee514_2021.html
Machine Learning: Overview
What is Machine Learning?
Given examples (training data), make a machine learn system
behavior or discover patterns
Data
Model
Algorithm f ( x)
Final output which
enables us to make
Given to us We need to design it predictions
Machine Learning: Overview
Algorithms vs Model
All labeled
Model Prediction
data
Supervised Learning
Regression
Regression: Quantitative Prediction on a continuous scale
Examples: Prediction of
- Age of a person from his/her photo
- Price of 10 Marla, 5-bedroom house in 2050
- USD/PKR exchange rate after one week What do all these problems
- Efficacy of Pfizer Covid vaccine have in common?
- Average temperature/Rainfall during monsoon
Continuous outputs
- Cumulative score in ML course
- Probability of decrease in the electricity prices in Pakistan
- No. of steps per day
- Features (Input)
- Labels (Output)
- Training data
?
?
?
Supervised Learning Setup
Formulation
?
?
?
Supervised Learning Setup
Formulation
Regression:
Classification:
Supervised Learning Setup
Example
MNIST Data:
- Each sample 28x28 pixel image
- 60,000 training data
- 10,000 testing data
Supervised Learning Setup
Learning
Supervised Learning Setup
Hypothesis Class
Q: How?
A:
Supervised Learning Setup
Q: How do we evaluate the performance?
A:
Loss Function
Supervised Learning Setup
Interpretation:
- Note normalization by the number of samples. This makes it the loss per sample.
- Loss function counts the number of mistakes made by hypothesis function D.
- Not used frequently due to non-differentiability and non-continuity.
Supervised Learning Setup
Interpretation:
- Again note normalization by the number of samples.
- Loss is always nonnegative.
- Loss grows quadratically with the absolute error amount in each sample.
Root Mean Squared Error (RMSE):
RMSE is just square root of squared loss function:
Supervised Learning Setup
Interpretation:
- Loss grows linearly with the absolute of the error in each prediction.
- Used in regression and suited for noisy data.
(Optimization problem)
Recall
Q: How can we ensure that hypothesis h will give low loss on the input not in D?
Supervised Learning Setup
Interpretation:
- 0% loss error on the training data (Model is fit to every data point in D).
- Large error for some input not in D
- First glimpse of overfitting.
Revisit:
Q: How can we ensure that hypothesis h will give low loss on the input not in D?
A: Train/Test Split
Supervised Learning Setup
Generalization: The Train-Test Split
You can only use the test dataset once after deciding on the model using training dataset
Supervised Learning Setup
Learning (Revisit after train-test split)
Evaluation
Supervised Learning Setup
Generalization loss
Supervised Learning Setup
Generalization: The Train-Test Split
Q: Idea:
Validation data is used evaluate the loss for a function h that is
determined using the learning on the training data-set. If the loss
on validation data is high for a given h, the hypothesis or model
needs to be changed.
Supervised Learning Setup
Generalization: The Train-Test Split
More explanation* to better understand the difference between validation and test data:
- Training set: A set of examples used for learning, that is to fit the
parameters of the hypothesis (model).
Adapted from *Brian Ripley, Pattern Recognition and Neural Networks, 1996
Supervised Learning Setup
Generalization: The Train-Test Split (Example)
• https://www.cs.cornell.edu/courses/cs4780/2018fa/
Email: [email protected]