Grokking Algorithms



Download 24,82 Mb.
Pdf ko'rish
bet93/122
Sana22.07.2022
Hajmi24,82 Mb.
#839971
1   ...   89   90   91   92   93   94   95   96   ...   122
Bog'liq
grokking-algorithms-illustrated-programmers-curious

k-nearest 
neighbors
10
Classifying oranges vs. grapefruit
Look at this fruit. Is it an orange or a grapefruit? 
Well, I know that grapefruits are generally bigger 
and redder. 


188
Chapter 10
 
 
I
 
 
k-nearest neighbors
My thought process is something like this: I have a graph in my mind.
Generally speaking, the bigger, redder fruit are grapefruits. This fruit
is big and red, so it’s probably a grapefruit. But what if you get a fruit 
like this?
How would you 
classify
this fruit? One way is to look at the neighbors of 
this spot. Take a look at the three closest neighbors of this spot.


189
Building a recommendations system
More neighbors are oranges than grapefruit. So this fruit is probably an 
orange. Congratulations: You just used the 
k-nearest neighbors
(KNN) 
algorithm for 
classification
! The whole algorithm is pretty simple.
The KNN algorithm is simple but useful! If you’re trying to classify 
something, you might want to try KNN first. Let’s look at a more
real-world example. 
Building a recommendations system
Suppose you’re Netflix, and you want to build a movie 
recommendations system for your users. On a high level, this
is similar to the grapefruit problem! 


190
Chapter 10
 
 
I
 
 
k-nearest neighbors
You can plot every user on a graph.
These users are plotted by similarity, so users with similar taste are 
plotted closer together. Suppose you want to recommend movies for 
Priyanka. Find the five users closest to her.
Justin, JC, Joey, Lance, and Chris all have similar taste in movies. So 
whatever movies 
they
like, Priyanka will probably like too! 
Once you have this graph, building a recommendations system is easy. 
If Justin likes a movie, recommend it to Priyanka.


191
Building a recommendations system
But there’s still a big piece missing. You graphed the users by similarity. 
How do you figure out how similar two users are? 

Download 24,82 Mb.

Do'stlaringiz bilan baham:
1   ...   89   90   91   92   93   94   95   96   ...   122




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish