Professional Documents
Culture Documents
KNN Worshop1
KNN Worshop1
KNN Worshop1
machine learning
Learning objectives
Movie fit
data with
revenue
+ model model
Movie
data predict Predictted
(unknown + model revenue
revenue )
Classification: Categorical Answers
Emails
labeled as fit
spam or + model model
not spam
Which flower is a
customer most likely to
purchase based on
similarity to previous
purchase?
What is Classification?
Which flower is a
customer most likely to
purchase based on
similarity to previous
purchase?
What is Classification?
Which flower is a
customer most likely to
purchase based on
similarity to previous
purchase?
What is Needed to Select a KNN Model?
• Correct value for 'K‘
• How to measure closeness of neighbors?
Age
Survived
Not Survived
Age
Predict
Survived
Not Survived
Age
Predict
Age
Predict
Age
Predict
Age
Predict
K=1 K = All
Age
K=5
Age
Fit the instance on the data and then predict the expected value
KNN = KNN.fit(X_data, y_data)
y_predict =KNN.predict(X_data)