Lec1 PerceptronPocket Recap
Lec1 PerceptronPocket Recap
Perceptron
10th Oct 2022
We infer a rule through instances…….
Class 1
Class 2
This is a typical
“Classification” Problem
Test sample : Only pattern is given
We need to complete the Tuple (Pattern, ??class label??)
Extending the problem
Training samples : Tuple (Pattern, class label)
Label = CAR Label = ??
Label = ??
Class 2
2
1
1 2 3 4 5 6
Training Sample Number
Feature space
• Feature extractor : Mapping from Data to Feature Space
• Feature Extractor : Data -> (Feature1,Feature2,..)
1 2 3 4 5 6
Training Sample Number
Data separability in Feature-space
Feature2
Feature2
Feature1 Feature1
Linearly separable Non-Linearly separable
2. Unsupervised Learning
From the Hypothesis set, we are choosing only those that are Linear !!
Linear Models
Please Remember :
Training Error = In-sample error
Testing Error = Out-of-sample error
Cost function contribution
Notice : All data points that are not on the line contribute to the cost
function
Cost function - Rewriting
Notice : All data points x1, x2…..xN contribute to the cost function
Vector calculus - Hints
T T T
= yTy- (Xw) y- y Xw + (Xw) (Xw)
= yTy - 2 y Xw + wTXTXw
T
T T T
Setting dJ/dw = 0
T T T
-2 (y X) + 2 X Xw = 0
T T T
(y X) = X Xw
T T T T
X Xw = (y X) = X y
T T
w = (X X) -1 X
1
(s) Where,
1 es
Logistic (Sigmoid) function
• Maps real line to [0,1]
• Can be used to model posterior probability i.e P(C | x)
• Final goal: Feature as input and output as posterior probability,
using the sigmoid model
1
( w x)
T
wT x
1 e
• Classifier
• Discriminative model (vs Generative model)
• Parameters – feature weights
• Estimation – ML estimation
• Gradient Descent (Iterative Method)
60
PLA
Cost function
Gradient Descent
61
Y
Iteration in PLA
62
Weight correction (blue to
black)
Perceptron inference
• Given this straight line, say we have learnt, the inference is as
follows :
• On the straight line x1-x2 = 0;
• If x1-x2 > 0, then RED class;
• If x1-x2 < 0 BLUE class
x1-x2 < 0
x2 x1-x2 = 0
x1-x2 > 0
x1
Linear Models