Coding Challenge #70: Nearest Neighbors Recommendation Engine - Part 2
ฝัง
- เผยแพร่เมื่อ 15 มิ.ย. 2024
- In this multi-part coding challenge, I create a movie recommendation engine using the "nearest neighbor" algorithm. Code: thecodingtrain.com/challenges...
p5.js Web Editor Sketches:
🕹️ Nearest Neighbors, Part 1: editor.p5js.org/codingtrain/s...
🕹️ Nearest Neighbors, Part 2: editor.p5js.org/codingtrain/s...
🕹️ Nearest Neighbors, Part 3: editor.p5js.org/codingtrain/s...
🕹️ Nearest Neighbors, Part 3 with added styling: editor.p5js.org/codingtrain/s...
Other Parts of this Challenge:
📺 Nearest Neighbors Recommendation Engine - Part 1: • Coding Challenge #70: ...
📺 Nearest Neighbors Recommendation Engine - Part 3: • Coding Challenge #70: ...
🎥 Previous video: • Coding Challenge #69: ...
🎥 Next video: • Coding Challenge #71: ...
🎥 All videos: • Coding Challenges
References:
📕 The Nature of Code Part 2 (Spring 2017) - Intelligence and Learning: github.com/shiffman/NOC-S17-2...
📓 Notes on Pearson's correlation coefficient: github.com/shiffman/NOC-S17-2...
Videos:
🚂 My Video on Associative Arrays: • 5.2: Associative Array...
🔴 Coding Train Live 91: • Live Stream #91: Sessi...
Related Coding Challenges:
🚂 #98 Quadtree: • Coding Challenge #98.1...
🚂 #104 Linear Regression with TensorFlow.js: • Coding Challenge #104:...
🚂 #105 Polynomial Regression with TensorFlow.js: • Coding Challenge #105:...
Timestamps:
0:00 Introduction
1:01 euclideanDistance()
1:44 Similarity score
1:58 NearestNeighbors()
2:51 Check similarity scores
6:28 Sort the users
10:29 Put similarity score in an object
14:03 Display top five similarity scores
16:00 Reset resultP
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
🚂 Website: thecodingtrain.com/
👾 Share Your Creation! thecodingtrain.com/guides/pas...
🚩 Suggest Topics: github.com/CodingTrain/Sugges...
💡 GitHub: github.com/CodingTrain
💬 Discord: thecodingtrain.com/discord
💖 Membership: th-cam.com/users/thecodingtrainjoin
🛒 Store: standard.tv/codingtrain
🖋️ Twitter: / thecodingtrain
📸 Instagram: / the.coding.train
🎥 Coding Challenges: • Coding Challenges
🎥 Intro to Programming: • Start learning here!
🔗 p5.js: p5js.org
🔗 p5.js Web Editor: editor.p5js.org/
🔗 Processing: processing.org
📄 Code of Conduct: github.com/CodingTrain/Code-o...
This description was auto-generated. If you see a problem, please open an issue: github.com/CodingTrain/thecod...
#nearestneighbors #similarityscore #euclideandistance #associativearrays #p5js #javascript
I like that you put the next part in the description.
Dude the last video was awesome. You connected euclidean distance math to data set. Introduced a weakness to the method and Provided Solution. This is like practical math making math more intuitive and relatable. The context of the programming makes the math so easy to digest. Thanks.
13:18 I have never seen Dan like this before. It's ok, we all make mistakes :)
I also think it's awesome that you didn't cut this out.
Have a nice day!
5 years too late, but if you use Union Finds then euclidean distance on the results of that, you can have a fully dynamic recommendation engine.
i actually did wake up this mourning and wish this, thankfully i do , it's still here, Dan exists, his channel exits, life exist sun is out tho i mostly hide from it and cover the windows
Can you make a video where you just trigger all the sounds you have(ding, thisdot, dundun...) preferably in form of a music?
Maybe write an algorithm that can imitate music with given sounds.
You could sort the names by their similarity score, at least in Python:
def k_nearest(k, names, scores):
return names.sort(lambda x: scores[names.index(x)])[::-1][:k]
If you have thousands and thousands of people's preferences, since we are calculating a "distance" couldn't we think of plotting people in an n dimensional space based on the number of movies and their ratings and then use a quadtree to more quickly get our nearest neighbors? This would probably be more useful if we wanted to group everyone since we would have to have nested loops, but just a thought.
*as lightning strikes and half of California loses power overnight*
hi dan, i was wondering if you can load a folder of images into Processing, if it is possible please tell my how to do that.
Thank you.
Is your distance normalized between 0 and 1? If so, why are all of your scores so low? I would think that there would bound to be some scores higher than a 0.36, but I didn't see any. Could be a bug!
any idea when there are 10000 users buying/not buying 20000 products? i guess the results have to be compiled first. but still that would be 10k by 10k by 20k loop.
Ever heard of RushBallz (IOS) or Boomerang balls (IOS) ? It would be awesome if you could make a challenge similar to those games
I have not, will look into it!
Awesome!
A doubt!! In compareSimilarity(), how come b.name is always Leon? data.users contains all users. Doesn't sort will pass all the users name as (a,b) argument. Why Leon is constant and other names changes in argument 'a'.
The console likely is only showing the last N logs. The last N logs were comparing users to Leon.
7:17 I think that 13 is in the wrong place
Daniel, why is this video not public yet? Forgot it?
No, he makes them public one at a time (for reasons that remain hidden from me).
It's possible I'm wrong about this, some reasons why I think (?) releasing one video per day as opposed to all at once: a) people miss parts 1 and 2 if all at once since notifications send you to the latest (part 3), b) youtube's algorithms like channels that release new content regularly so try to do 9/10am every morning, c) i get more views / traffic this way? Still learning the best way to do all this.
At 7:24, how is 5 > 13 ?
Javascript sorts alphabetically. This means that "13" is lower than "5", because "1" is lower than "5".
You can try this function though,
function sorter(a, b) {
if (a < b) return -1; // any negative number works
if (a > b) return 1; // any positive number works
return 0; // equal values MUST yield zero
}
Mohit Karangiya that doesn’t explain it, something’s wrong there.
Coding challenge: Optimize NASA code.
(its actually real)
Links please!
Here: futurism.com/thousands-of-dollars-up-for-grabs-in-nasa-coding-challenge/
Dont know if its real though...
The Coding Train oh solve google hash code problem 1 2017 more realistic
@@kurekureci Hey, I went to the link and read the article. I'm a BSc in Maths and I know some FORTRAN. Too bad that I'm not eligible for the bounties though, since I'm a UK citizen. Is there any workaround?
Do you drink a can of monster before each video?
It's ginger tea.
neigbhors
hia
Are all your videos targeted to programming noobs ? Are there any videos for people already well versed in programming ? For example : i can't stand you explaining sorting for 5 minutes :P
From his wiki page, I gather that his background is more into math and arts. The fact that his videos appeal to noobs make them interesting I guess coz he dabs with wide array of topics. If he did not explain perlin noise or fractals first you wouldn't know what he was talking about in first place.
But yeah sorting is too basic I guess. You can watch videos at 2-3x speed. Use J,K,L shortcuts to quickly move back 10 secs, pause, move forward 10 secs.