Classification Models - 2018

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

CLASSIFICATION MODELS

MEDELIN.RB
CLASSIFICATION MODELS

ROADMAP

▸ Gradient Descent

▸ K Nearest Neighbors

▸ Decision Trees

▸ Naive Bayes

▸ …
CLASSIFICATION MODELS

NEAREST NEIGHBORS

▸ Why?

▸ Machine Learning Algorithms


(pattern recognition)

▸ Simplest models
(no mathematical assumptions)

▸ Simple Intuition
CLASSIFICATION MODELS

NEAREST NEIGHBORS

▸ INPUTS

▸ k closest training examples in the feature space

▸ OUTPUTS

▸ Classification
(label/class, by a majority vote of its neighbors)

▸ Regression
(average of the values of its k nearest neighbors)
CLASSIFICATION MODELS

NEAREST NEIGHBORS
CLASSIFICATION MODELS

NEAREST NEIGHBORS
CLASSIFICATION MODELS

K-NEAREST NEIGHBORS
CLASSIFICATION MODELS

NEAREST NEIGHBORS

▸ Needs?

▸ Some notion of distance

▸ Assumption about closest point similarity


CLASSIFICATION MODELS

DISTANCE
CLASSIFICATION MODELS

DISTANCE
CLASSIFICATION MODELS

DISTANCE R^N
CLASSIFICATION MODELS

DISTANCE

def euclidian_distance (vector1, vector2)


result = vector1.zip(vector2).reduce(0) do |sum, pair|
sum += (pair[0] - pair[1]) ** 2
end
Math.sqrt(result)
end
KNN

DEMO
CLASSIFICATION MODELS

CAVEATS

▸ Take K into account

▸ Majority of votes

▸ Average values

▸ Intensive calculations

▸ N^2
THANKS!

Q&A

You might also like