r/learnmachinelearning • u/not-okarun • 25d ago
i build Kmeans an unsupervised machine learning algorithm from scratch
It's Day 59 of building machine learning algorithms from Scratch and im currently into unsupervised learning in short i've completed all the algorithms in supervised learning.
Well the crazy part I'm only 2 algorithms and 2 concept for completing Machine learning and I'm diving into "Deep learning" I'm way too excited too explore new things,build new things, let see how far it takes me
Peoples dreams... have no end!!
72
Upvotes



10
u/Ok-Library1020 24d ago
nice one. an edge case worth testing is a cluster that ends up with zero points after assignment, since the mean update divides by zero there. reinitializing that centroid or just keeping its old position avoids the NaNs
2
u/Intelligent-Tour8322 25d ago
What do the red crosses in the 1st picture represent?
3
u/ds_account_ 24d ago
Nice, now can you do it in 40 min during a coding interview.
1
u/Open_Two_1119 23d ago
Self.iterations is unused :)
Great job!
1
u/cajmorgans 23d ago
Try solving it with broadcasting instead of loops! You can do this entirely with matrix multiplication and some broadcasting
-3
u/Fun-Site-6434 24d ago
Sure you did buddy!