



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















For a discrete random variable X, the expectation is defined as: E[X] = x xfX (x) For a continuous random variable X, the expectation is defined as: E[X] = ∞ −∞ xfX (x)dx Let Y = r(X). Then E[Y] can be computed as: E[Y ] = ∞ −∞ r(x)fX (x)dx E[Y ] = x r(x)fX (x) continuous discrete
Random variables X and Y are independent if for any two sets A and B, P (X ∈ A, Y ∈ B) = P (X ∈ A)P (Y ∈ B) For two random variables X,Y, cov(X,Y) = E( (X - E[X]) (Y - E[Y]) ) cov(X,Y) can also be written as: cov(X,Y) = E(XY) - E(X) E(Y) Property: If X and Y are independent, then Var(X + Y) = Var(X) + Var(Y) Cov(X,Y) = 0 Does the converse hold? Docsity.com
Homework 1 due on Wed Apr 18
Midterm 1 is on Mon Apr 23
Material for midterm:
Linear algebra review, probability review
k-nearest neighbors
Set of input examples (xi, yi) Classification Algorithm Prediction Rule New example x Label y
Set of input examples (xi, yi) Classification Algorithm Prediction Rule New example x Label y Training Data Test Data Training and test data must be separate!
where y is discrete , predict y values for unseen x Example 1: Which digit in the image? Label: 0,1,.., What are the features? Vector of pixel colors 0 0 1 0 1 0 1 ... Image x (0 for white, 1 for black) Given labeled data (xi, yi), i=1,..,n,
Training error: For a classifier f, given training data (x 1 ,y 1 ),..(xm, ym) 1 m m j= Training error =^1 [f^ (xj )^ =^ yj ]
Training error: For a classifier f, given training data (x 1 ,y 1 ),..(xm, ym) 1 m m j= Training error =^1 [f^ (xj )^ =^ yj ] For a classifier f, given test data (x 1 ,y 1 ),..(xm, ym) 1 m m j= Test error =^1 [f^ (xj )^ =^ yj ] Test error: Both are proxy for the true error of the classifier: True error = where data (both training and test) are drawn from an underlying distribution D E(X,Y )∼D [1[f (X) = Y ]]
Usually, training error is less than test error. Test error is a better measure than training error. Training error: For a classifier f, given training data (x 1 ,y 1 ),..(xm, ym) 1 m m j= Training error =^1 [f^ (xj )^ =^ yj ] For a classifier f, given test data (x 1 ,y 1 ),..(xm, ym) 1 m m j= Test error =^1 [f^ (xj )^ =^ yj ] Test error:
Labelled examples (x 1 , y 1 ), .., (xn, yn), Predict label of a new example x Given: Solution: Return yj j = argmini d(x, xi) d is the distance
x=-1 (^) x=0 x= Training Data x=4 x= What does the classifier look like?
Assign to a test example the same label as its closest training example Red: training points Blue cell: region with same label as the training example in it Voronoi diagram
Training Data: ( (1, 1), 1 ) ( (-1, -1), 1 ) ( (1, -1), 2 ) ( (-1, 1), 2 )