{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

12-knn_perceptron

12-knn_perceptron - CS246 Mining Massive Datasets Jure...

Info icon This preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
CS246: Mining Massive Datasets Jure Leskovec, Stanford University http://cs246.stanford.edu
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Would like to do prediction: estimate a function f(x) so that y = f(x) Where y can be: Real number : Regression Categorical : Classification Complex object: Ranking of items, Parse tree, etc. Data is labeled : Have many pairs {(x, y)} x … vector of real valued features y … class ({+1, -1}, or a real number) 2/14/2011 Jure Leskovec, Stanford C246: Mining Massive Datasets 2 X Y X’ Y’ Training and test set
Image of page 2
We will talk about the following methods: k-Nearest Neighbor (Instance based learning) Perceptron algorithm Support Vector Machines Decision trees Main question: How to efficiently train (build a model/find model parameters) ? 2/14/2011 Jure Leskovec, Stanford C246: Mining Massive Datasets 3
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Instance based learning Example: Nearest neighbor Keep the whole training dataset: {(x, y)} A query example (vector) q comes Find closest example(s) x* Predict y* Can be used both for regression and classification Recommendation systems 2/14/2011 Jure Leskovec, Stanford C246: Mining Massive Datasets 4
Image of page 4
To make Nearest Neighbor work we need 4 things: Distance metric: Euclidean How many neighbors to look at? One Weighting function (optional): Unused How to fit with the local points? Just predict the same output as the nearest neighbor 2/14/2011 Jure Leskovec, Stanford C246: Mining Massive Datasets 5
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Suppose x 1 ,…, x m are two dimensional: x 1 =(x 11 ,x 12 ), x 2 =(x 21 ,x 22 ), … One can draw nearest neighbor regions: 2/14/2011 Jure Leskovec, Stanford C246: Mining Massive Datasets 6 d(x i ,x j ) = (x i1 -x j1 ) 2 + (x i2 -x j2 ) 2 d(x i ,x j ) = (x i1 -x j1 ) 2 + (3x i2 -3x j2 ) 2
Image of page 6
Distance metric: Euclidean How many neighbors to look at? k Weighting function (optional): Unused How to fit with the local points? Just predict the average output among k nearest neighbors 2/14/2011 Jure Leskovec, Stanford C246: Mining Massive Datasets 7 k=9
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Distance metric: Euclidean How many neighbors to look at? All of them (!) Weighting function: w i = exp(-d(x i , q) 2 /K w ) Nearby points to query q are weighted more strongly. K w …kernel width. How to fit with the local points? Predict weighted average: Σ w i y i / Σ w i 2/14/2011 Jure Leskovec, Stanford C246: Mining Massive Datasets 8 K=10 K=20 K=80 d(x i , q) = 0 w i
Image of page 8
Given: a set P of n points in R d Goal: Given a query point q NN: find the nearest neighbor p of q in P Range search: find one/all points in P within distance r from q 2/14/2011 Jure Leskovec, Stanford C246: Mining Massive Datasets 9 q p
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Main memory: Linear scan Tree based: Quadtree kd-tree Hashing: Locality-Sensitive Hashing Secondary storage: R-trees 2/14/2011 Jure Leskovec, Stanford C246: Mining Massive Datasets 10
Image of page 10
Simplest spatial structure on Earth!
Image of page 11

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern