10. How do you find the best K?
• The process of find the best hyper-parameters
for a algorithm is called hyper-parameter
tuning.
• In case of KNN, we tune a single parameter
called K.
11. What is a good price for
House 1?
(a)10,000 (b) 5,000?
House
Number
Square feet age Price
1 1000 0
2 800 0 10,000$
3 1000 100 5,000$
12. What do you think KNN will do if K=1?
Who is the nearest neighbor of the first
house?
House
Number
Square feet age Price
1 1000 0
2 800 0 10,000$
3 1000 100 5,000$
13. Square feet age Price
1000 0
800 0 10,000$
1000 100 5,000$
Distance(House 1, House 2) = 200
Distance(House 1, House 3) = 100
14. Drawbacks of KNN
• Scaling: Different features may have different
ranges in numbers
15. Lets try it!
• Build an AI to predict
house prices
• Change K and see
how the AI behaves!