Supervised
Learning
Session 3
ACM AI + ACM TeachLA
Slides Link:
https://teachla.uclaacm.com/classes/ml
What are you going to be for Halloween?
Recap
Key Terms
AI
ML
Supervised Learning?
It's one of the most widely used forms of machine learning!
Supervised
guided
helped
directed
Let’s imagine a basketball game...
...with 3 seconds left, down by 1!
0 : 0 3
99
Team Lebron
100
USC
0 : 0 3
99
Team Lebron
100
USC
Our captain (Mr. Supervisor)
has the ball (input)!
input
0 : 0 3
99
Team Lebron
100
USC
but is trapped!
0 : 0 3
99
Team Lebron
100
USC
Mr. Supervisor passes to Mr. Model who can score!
MODEL
MODEL
However, Mr. Model actually doesn’t know how to play basketball 😳
. . .he was given the ball (input data) but. . .
input
. . .doesn’t know what to do (output)
output
MODEL
Mr. Model needs a supervisor to point him in the right direction. . .
input
output
Mr. Supervisor is here to tell him the output (what he should do)
MODEL
Mr. Supervisor: I DON'T CARE HOW you do it, just make sure the ball goes in the basket!
output
input
MODEL
input
output
output
Now that Mr. Model has an idea of the end result (output). . .
Mr. Model can use the ball (input) to score!
MODEL
input
labeled
output
Now that Mr. Model has an idea of the end result (output). . .
Mr. Model can use the ball (input) to score!
In other words. . .
The model uses input and labeled output
data to map the input to the output
Input Data
ML Model
Labeled Output Data
it’s like a big math function!
*Except instead of figuring out the output, we’re figuring out the relationship of input->output
Supervised Learning:
The model (function) uses input and labeled
output data to map the input to the output
For reference...
Normal/AI outside ML
f(x) = y
Machine Learning
f(x) = y
Supervised Learning:
The model (function) uses input and labeled
output data to map the input to the output
Input Data
ML Model
Labeled Output Data
take a moment to let that sink in!
It’s “supervised” because we tell the model the labeled output beforehand
Recap So Far:
Training Models
Not these types of models!
Mapping? Learning?
map
Mapping? Learning?
Let's take a look at our basketball example again...
input
output
Recall that Mr. Model doesn’t know how to play basketball
MODEL
He doesn’t know how to:
He has to train to learn those skills!
Training
So in order to map input to output consistently...
Training
So in order to map input to output consistently...
Mr. Model must train so he gets good at scoring baskets
(input → output)
input
MODEL
A Model in Training
A “Trained” Model
So after hours of training… Mr. Model is now trained and able to score hoops!
MODEL
Training a machine learning model is a long, hefty mathematical process
We’ll learn how it specifically works in the coming weeks!
input
How to Effectively Train Models
Effective Training
During preseason, in preparation for the NBA season Mr. Model trains a lot
MODEL
He trains by playing against the B team, his training data
B Team
A training dataset is any dataset that allows our model to train (map input -> output)
B Team
MODEL
In our case, the B Team is our training dataset: Mr. Model trains on them in order to learn how to play bball
Let’s take a closer look at our B Team data!
Training on the B Team
4 feet
The average height of the B Team is 4 feet. . .
So Mr. Model just dunks on them everytime
**It’s so effective, it becomes the only thing Mr. Model learns how to do
B Team
(Training Data)
Testing our training abilities
Now that preseason is over, it’s time to test Mr. Model’s new bball skills...
Training Data
(Preseason)
Trained Model
...on the NBA!
Test Dataset
When we want to test to see if our model is well trained, we test our model on a test dataset
Test Data
(NBA)
The test dataset is an example of what the model will see in the real world…
it’s a true test of its abilities!
Effective Training??
As we test Mr. Model plays against the tall, skilled players of the NBA we almost forgot...
MODEL
…that he only knows how to dunk!
He’s only able to dunk on people that are 4 feet tall! (B Team)
(In)effective Training
Did Mr. Model have good training? Especially if he plans to play against the tall, skilled players of the NBA?
MODEL
8 feet!
(In)effective Training (cont’d)
MODEL
Did Mr. Model have good training? Especially if he plans to play against the tall, skilled players of the NBA?
NO
Mr. Model has become so accustomed to dunking on the short players of the B Team that. . .
MODEL
. . .he sucks at playing against anyone taller than 6 feet because dunking won’t work on them!
Mr. Model had bad training!
(In)effective Training (cont’d)
Overfitting
Whenever a model has become too accustomed to a specific dataset (playing against B team too much), it’s called overfitting.
Overfitting (cont.)
Combatting Overfitting
What are some ways Mr. Model could’ve avoided overfitting?
Combatting Overfitting (cont.)
What does this tell us about the training dataset?
B Team
(Training Data)
4 feet
BAD!
**Avoid training against a small subset of your population, or else you’ll get creamed like Mr. Model in the NBA!
Underfitting
Conversely, if Mr. Model is lazy (doesn’t have much data to train on) he can be susceptible to underfitting
MODEL
Underfitting: when the model is too basic, and doesn’t work effectively in most situations
How do we combat this?
Gather more data to train on!
Training (graphically)
The black dotted line represents our model.
Training (graphically)
Amount of water given
Amount of water given
Amount of water given
Growth
Growth
Growth
¡Kahoot!
Homework (optional)
Closing Comments
Key Takeaways
Thanks!
ACM AI