Week 1 Lecture 2
Christian Igel
@christian_igel
The Learning Problem
Christian’s slides are “pretty self-contained”. They should work as course notes
Supervised Learning Scenario
Learning is goal-directed changingof behaviour based on experience
Binary Classification
Two classes: {apples, pears}, {-1, 1}
Supervised learning is to uncover an unknown relation between the input and output space
Based on sample input-output data
S = {(x_1, y_1),…,(x_N,y_N)}
l.i.d.: identically independently distributed
assumtion: Each pattern in the distribution is drawn independently from a stable distribution over
for example:
- The probability of a (red, 8cm, round) fruit is always the same for each sample
- Probability of being an apple is the same for each fruit that is (red, 8cm, round)
A hypothesis maps inputs to outputs. A hypothesis class is a set of such functions
Applying a learning algorithm means finding a hypothesis given sample data. i.e. it maps from to
Loss/risk function: numberically show how bad a certain output is. , where
Given sample data, we want to find hypothesis showing good average performance
I.e. we want to minimize the risk:
Empirical risk of on a sample data () is:
If we define the loss function to be: , then the empirical risk is:
(Indicator function is if it’s argument is true, otherwise 0)
Regression: Under the squared error the empirical risk corresesponds to the sum-of-squares error
Minimum risk over all measrable functions is the Bayes risk
usually differs from
For , the bayes risk is: . This can be done just by choosing the most likely one.
Algorithm is consistent if
In many cases, can’t be reached
“No free lunch”
Prior knowledge can be incorporated by:
- restriction of the hypothesis space (inductive bias)
- a proper definition of neighbourhood/similarity (i.e. by defining some metric)
- penalising the “complexity” of classifiers (i.e. preferring simpler solutions)
Nearest Neighbor Classification
Every point is classified as the sample that’s nearest to it
Idea:
- given training data
“nearest” requires some understanding of “similarity”; a metric.
Metric or distance function on is a function with the following properties ():
- (triangle inequality)
1-Nearest neighbor (1-NN): just finding the nearest item from the training data K-Nearest neighbor (K-NN): just finding the nearest items from the training data, and use the result that’s the most common from them.
Generalization and Regularization
1-NN will be (by definition) errorless on the training data
Minimizing empirical risk does not imply good generalization overfitting
We can see, that training data is not good for evaluating a hypothesis. We need some test data.
I.e. (empirical risk over the test data) is an unbiased estimator of (risk of the hypothesis)
law of large numbers mentioned (larger testing set will improve risk estimate)
Selection of hypothesis (lecture note):
- Choosing the archer with the most bullseyes probably chooses the best archery player
- BUT if a room of 100 were to flip 1000 coins, and we choose the person who had the most tails, the expected number of tails is obviously over 0.5.
- if we were to apply this to finding minimum risk over some hypotheses, we’d find a good hypothesis, but an overoptimistic estimate of its risk
- (Jensen’s inequality)
Cross-validation for Hyperparameter Selection
How to chose for K-NN
Algorithm parameters like are called hyperparameters
Model selection: finding hyperparameters
Standard method for selecting from a few hyperparameters: -fold cross-validation
- Select a value for the hyperparameter
- Split into parts (hopefully even parts)
- Train times on parts and test the held-out part (test set)
- The estimate for that specific hyperparameter setting, is the mean of all empirical risks
- Take hyperparameters maximising mean performance on the test set