K-Means Clustering in Python - Machine Learning From Scratch 12 - Python Tutorial

preview_player
Показать описание
Get my Free NumPy Handbook:

In this Machine Learning from Scratch Tutorial, we are going to implement a K-Means algorithm using only built-in Python modules and numpy. We will also learn about the concept and the math behind this popular ML algorithm.

~~~~~~~~~~~~~~ GREAT PLUGINS FOR YOUR CODE EDITOR ~~~~~~~~~~~~~~

📓 Notebooks available on Patreon:

If you enjoyed this video, please subscribe to the channel!

The code can be found here:

You can find me here:

#Python #MachineLearning

----------------------------------------------------------------------------------------------------------
* This is a sponsored link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏
Рекомендации по теме
Комментарии
Автор

thank you for the tutorial! it is very clear for both the concept explanation and coding !

arieljiang
Автор

Huge thanks for such an impressive tutorial. Glad I've found your channel

AlexanderShs
Автор

i love this videoooo too much this is the must to have in a datascientist toolkit

spider
Автор

Dude your video is heavily underappreciated . This video helped me a lot.

supratimmalakar
Автор

Thank! Good tutorial!
This is my first comment on YouTube. And I'm glad I left him for this video.

vovchikigrovoy
Автор

Great video!! I will look for dp mean next :P! but I will def look at more of your vid.

Jeryboulet
Автор

How can I obtain the centroids of the clusters? Is there any way I can print the centroids?

swarnendusekharghosh
Автор

How can I do this with a list of HEX colours I have made RGB colours? I want to reduce the cardinality.

gochasethesunset
Автор

Hello Python Engineer, I am trying to get the size of the clusters right after the first Iteration, can you help me with that?

ajinkyaindulkar
Автор

How do we implement this class for a dataset that we already have?

xdarshan
Автор

I have a question that X.shape here is a tuple which is (500, 2). when I use random.choice, the obtained value is always randomly chosen of 500 or 2. Shouldn't it be len instead?
thank you
self.n_samples, self.n_features = X.shape
random_sample_idxs = np.random.choice(self.n_samples, self.K, replace=False)

shengxinjin
Автор

Thanks for sharing! Keep it going).
By the way what the IDE do you use?

ttuyspu
Автор

how to pass latent space as input to this clustering program? please replyyy

manalihiremath
Автор

Hi, How can we perform the testing on the test data (new data) when we get it.

ArjunSharma-vyfv
Автор

Hello, I don't understand the part self.clusters = [ [ ] for _ in range(self.K)]. Is this creating a list with K elements? Such as if K = 5, then self.clusters = [1, 2, 3, 4, 5]?

bryanchambers
Автор

why pass in parameter when you created a class property with self.centroid in line 31.

laveenabachani
Автор

Hello! Thank you for this tutorial. I have a question: Is it necessary to write the code by scratch only using numpy? Why didn't you use sklearn module?

animuradyan
Автор

How can I choose a different distance measure, I would like to try Pearson as my distance measure? Thanks

chavianddavid
Автор

thank you very much Patrick.Huge thanks! Can you elaborate how the clustering would work on multidimensional data like the Iris dataset.How do we calculate euclidian distances in this case?

mkalantzaki
Автор

Thank you very much!
How to add label in each clusters and change the color? so in pyplot legend, there are names for each colors?
Example, there are 3 clusters, they are cluster 0, 1 and 2, those are integer, and i want to add label string to them like low, mid, and high.

muhammadalkahfi