Machine Learning Tutorial Python - 13: K Means Clustering Algorithm

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

Комментарии • 609

  • @codebasics
    @codebasics  2 года назад +13

    Check out our premium machine learning course with 2 Industry projects: codebasics.io/courses/machine-learning-for-data-science-beginners-to-advanced

    • @vitaltopics316
      @vitaltopics316 2 года назад

      why do we not need to use centroids for the iris dataset?

  • @hshrestha2811
    @hshrestha2811 4 года назад +75

    Summarizing the algorithm for K Means clustering based on this video:
    1. Start with k centroids by putting them at random points here k =2
    2. Compute distance of every point from centroid and cluster them accordingly
    3. Adjust centroid so they become center of gravity of given cluster
    4. Again recluster every point based on distance with adjusted centroid
    5. Reiterate until data points stop changing cluster
    6. Again adjust centroids

    • @adipurnomo5683
      @adipurnomo5683 3 года назад +1

      Noted!

    • @fun_stuff_and_games
      @fun_stuff_and_games Год назад +1

      7. done and put the ruler away

    • @ganeshn9464
      @ganeshn9464 Год назад +1

      Please correct me if I am wrong -
      2. Compute distance of every point from centroid and cluster them accordingly - This entire process is "built" inside the KMeans.fit_predict(). Correct ?

    • @ZlogsUK
      @ZlogsUK Месяц назад

      its easy to undersytand theory implementations trickyu

  • @shauryabhatnagar71
    @shauryabhatnagar71 4 года назад +34

    You are probably one of the best teachers I have come across. Thank you so much!

  • @arrahman100
    @arrahman100 5 лет назад +199

    You make Machine Learning so easy to understand. I would say you are a SAVER for the people who are struggling to understand different ML algorithums. Thank you so much. please if possible put some content on NLP.

  • @wyphonema4024
    @wyphonema4024 4 года назад +5

    my grad school professor explains this very badly. You explain things very well with patience, you are the definition of a good teacher

  • @qas4273
    @qas4273 4 года назад +15

    It's a blessing to be able to finally say that I can learn ML, thanks to you :). I have used 'HUE' from seaborn instead of writing plt.scatter for every group of the cluster. sns.scatterplot(df['Age'], df['Income($)'], hue = df['Cluster'])

    • @manishsharma2211
      @manishsharma2211 4 года назад +2

      Thanks for this 👍

    • @codebasics
      @codebasics  6 месяцев назад +1

      Yes, with seaborn you can do it in one line. Thanks for posting this comment 🙏🏼🙏🏼

  • @AltafAnsari-tf9nl
    @AltafAnsari-tf9nl 4 года назад +7

    I have started loving machine learning due to the simplicity of explanations.

  • @aliouahli3185
    @aliouahli3185 2 года назад

    you can't find a video and not watch all playlists , im so grateful to you , thank you sir!

  • @cindinishimoto9528
    @cindinishimoto9528 4 года назад +57

    All the ML series is so exciting. I'm learning and having fun during the quarantine in Brazil, SP.
    Thanks, @codebasics

  • @beansgoya
    @beansgoya 5 лет назад +6

    Fantastic explanation. I like the way you showed us what happens if you don’t scale your features. You also waited for the perfect opportunity to show why we need to use the elbow method.

    • @codebasics
      @codebasics  5 лет назад +2

      Thanks for your feedback kin. 👍😊 Feedback like this helps me continue do the good things and also any critical feedback is welcome as well as it helps me improve 👍

  • @Rus1310CMRS
    @Rus1310CMRS Год назад

    I looked 5 min at start, and your teaching style for ML is spot on, better than the IIT professors. I am enjoying ML algo now. Thanks.

  • @nilupulperera
    @nilupulperera 4 года назад +8

    What a beautiful explanation. The beauty of Data Science is shown in this video in a remarkable way.
    The exercise is really beautiful!
    Thank you very much, Sir.

    • @codebasics
      @codebasics  4 года назад +2

      Dear Nilpul, Thanks for the comment. Keep learning. 😂

  • @amilcarc.dasilva5665
    @amilcarc.dasilva5665 5 лет назад +30

    Excellent tutorial. This is highly recommended to watch. Thanks a lot Sir, I find it helpful in my project work....I really appreciate. You have done great work to help others. Keep up doing this great work.

  • @Mukeshsingh-zn9rq
    @Mukeshsingh-zn9rq 4 года назад +1

    was trying out tons of videos trying to understand the basics of ML, you made it so simple and quick.
    Loved it!!

  • @andreabrunelli2030
    @andreabrunelli2030 3 года назад

    Dear CodeBasics, your tutorials are way better than all the classes of the Master in AI I have just completed. Thank you very much!

    • @codebasics
      @codebasics  3 года назад +1

      Glad it helped you 😊

  • @NikitaSharma-bs4gg
    @NikitaSharma-bs4gg 2 года назад

    I searched for 3-4 days and I only got the plotting after seeing your video- Thanks a lot

  • @Kingsohio
    @Kingsohio 3 года назад

    This is a great quick refresher for those with the basic knowledge of ML clustering algorithms

  • @commercial3750
    @commercial3750 Год назад

    This was awesome! I can't believe I learned how to do K-means clustering in just a few hours. Your explanations are clear and concise. Thank you so much!

  • @sidduhedaginal
    @sidduhedaginal 4 года назад +21

    Sir, you made Machine Learners life easy....amazing explanation that ever seen before and by Elbow technique we got K=3 for iris dateset.

    • @codebasics
      @codebasics  4 года назад +4

      Thanks for you kind words and I am happy you liked it 😊

    • @shubhangiagrawal336
      @shubhangiagrawal336 4 года назад +4

      @@codebasics Sir can you please make one video on knn algorithm? I need it so badly. Thankyou

  • @praveenjagarlapudi7891
    @praveenjagarlapudi7891 2 года назад

    I have got the real clarity after watching your video, This is a great help. Thank you for all the videos.

  • @namansinghal9090
    @namansinghal9090 4 года назад +5

    I must say!! you are making life alot easier for all of us!!! Thanks a lot mannn.. Your efforts are really appreciated. Keep up hard work.

  • @raom2127
    @raom2127 3 года назад

    All ML series Iam following, Iam following to your vedios nicely explained you explaination ans approach is awasome now I stopped seeing all news social media network just following up your vedios only.....your vedios has magentic power........................

  • @heaven3279
    @heaven3279 3 года назад

    Excellent quick and short explanation of K-means. Appreciate it

  • @shubhamwaingade4144
    @shubhamwaingade4144 3 года назад

    It was good, simple, informative, no errors. I guess these are enough clusters to define the quality of this video.

  • @pandaparas8500
    @pandaparas8500 5 лет назад +1

    You make every topic so easy to understand. Long time no video, we miss your videos. Please upload video regularly. Once again good to see your videos. Thank u

    • @codebasics
      @codebasics  5 лет назад +1

      Panda, thanks for your appreciation. I am going through some health issues and that's the reason not able to upload the content on regular basis. I will start uploading once I recover... 🙂

    • @pandaparas8500
      @pandaparas8500 5 лет назад +1

      @@codebasics oh sorry i m not aware of it.Its ok. Take your time and concentrate on full health recovery . Get well soon sir. Take care. Once again thank u for everything 😊

  • @skyblue021
    @skyblue021 3 года назад +1

    This is the best-explained K-means on the internet - period. Thank you!

  • @manjulakalmath4591
    @manjulakalmath4591 Месяц назад +1

    Really it is invaluable and unconditional service

  • @jayagrawal3481
    @jayagrawal3481 11 месяцев назад

    really liking the course i cant believe i already watched more than 50 videos from a playlist only 50 more to go

  • @prakashdahal2560
    @prakashdahal2560 5 лет назад +1

    One of the most useful tutorial I have ever seen

  • @akshrags-mindmaze3407
    @akshrags-mindmaze3407 Год назад +1

    7:25 Brilliant Explaination!

  • @doyoonkim4187
    @doyoonkim4187 2 года назад

    The best ML lesson I've ever heard

  • @bhaskarg8438
    @bhaskarg8438 2 года назад +1

    your explanation is clear and clarity in the content.. and knowledge sharing to needed Data Science community is Nobel... thankyou... 🙏

  • @santetzuken8903
    @santetzuken8903 4 года назад

    These videos are more helpful than all of the classes I took in my university combined.

    • @codebasics
      @codebasics  4 года назад +2

      I am happy this was helpful to you.

  • @flyingsalmon
    @flyingsalmon 2 года назад

    Fantastic coverage...you covered the basics, then talked about the reasons and potential challenge with real-world data, and showed some amazing methods to visualize differently. Thank you for your continued contribution to learning and sharing with the community. This kind of tutorials is what will make newcomers gravitate toward ML and be glad to learn.

    • @codebasics
      @codebasics  2 года назад +1

      Glad you enjoyed it!

    • @flyingsalmon
      @flyingsalmon 2 года назад

      @@codebasics Absolutely. I do have a follow-up question. I got lost after scaling the values...let me explain. I have a dataset of tips($) and total restaurant bill($) per day per group of customers. I got 3 clusters and they look good after rescaling the bill and tips via MinMax (my x-axis is the bill for food, and y-axis is tips $). But after clustering, I can't tell how to map the x-axis and y-axis rescaled values (which are 0..1 floats) to actual dollar values that are in the dataset. I need to know how the clusters map to real dataset. Is there a way to do that logically? Would really appreciate your input. TY!

  • @meghnasachdeva3174
    @meghnasachdeva3174 4 года назад +1

    the way yoy explain is commendable making it so easy even fote beginners....thankyou so much for your efforts sir..really

  • @Mushsayer
    @Mushsayer 3 года назад

    Thanks a lot for the video. You taught the K-Means Clustering
    in 10 mins!

  • @tejas4054
    @tejas4054 Год назад

    This is best video of all ml videos on youtube

  • @zainishah5540
    @zainishah5540 3 года назад

    Oh man just wow wow wow. You made my day what a lesson it was. Absolutely you nailed it

  • @mapa5000
    @mapa5000 Год назад

    Outstanding explanation my friend !! Thank you from Houston

  • @saratbabum1303
    @saratbabum1303 4 года назад +1

    Nice way of explaining the complicated concept with an example. Great Job !!! Thanks a lot

  • @pulkitgupta1946
    @pulkitgupta1946 5 лет назад +1

    sir bas aap please video upload karte rehna . aapki videos se bahut help milti hai

    • @codebasics
      @codebasics  5 лет назад +2

      Sure pulkit. Me koshish yahi karunga ke jyada se jyada achhe video produce karta rahu on machine learning.

    • @pulkitgupta1946
      @pulkitgupta1946 5 лет назад

      Thanks

  • @abhishek4985
    @abhishek4985 3 года назад

    Saw so many videos, but this one video helped the most. Thanks!

  • @maruthiprasad8184
    @maruthiprasad8184 2 года назад

    Optimal value for iris data set got 3. Thank you very much for simple & great explanation.

  • @igorbuzov3778
    @igorbuzov3778 4 года назад +1

    Going to university, studying, learning, reading from books
    And then you find some random guy form (I assume India) who exlans it in simple way.in less than 30 minutes... Respect!

    • @codebasics
      @codebasics  4 года назад +3

      I am glad Igor that this was helpful to you 😊👍

  • @Sheblah1
    @Sheblah1 Год назад

    this is a perfect introduction to k-means thank you for making this video👌

  • @sunilsharanappa7721
    @sunilsharanappa7721 4 года назад +1

    You are awesome, you make the complex things simplified.Please keep up the good work.

  • @simranthiara6616
    @simranthiara6616 4 года назад

    Best channel for explanations on ML algorithms. Thank you so much :) , definitely subscribed .

  • @prasannavi1911
    @prasannavi1911 5 лет назад +1

    You are awesome. You made me think ML is not complex to learn.

    • @codebasics
      @codebasics  5 лет назад

      Indeed, ML is not as complex as people think it is !

    • @prasannavi1911
      @prasannavi1911 5 лет назад

      codebasics thank you. Post more videos your way to explaining things well understood.

  • @adisaolaitan5475
    @adisaolaitan5475 5 лет назад +2

    Thanks so much for your easy-to-understand tutorials. You are a blessing. God bless you!

  • @shashankkkk
    @shashankkkk 3 года назад

    man you shouldn't have put these playlists on youtube for free... these are gems... people should pay to learn these gems for at least some small amount.. You are awesome sir ... The things which I wasn't able to learn you taught me in that... hats off sir... hope we will meet one day

    • @codebasics
      @codebasics  3 года назад +1

      Thanks for your appreciation, sure when I am in India I will plan for a Meetup

  • @praveensevenhills
    @praveensevenhills Год назад

    great explanation taking from a small example and going in elaborative way covering whole concept in a nutshell very well explained

  • @shantanuraj7086
    @shantanuraj7086 3 года назад

    Amazing video. Creative, resourceful and excellent preparation. Keep posting more such videos.

  • @86Plum
    @86Plum 4 года назад +1

    Amazing video and explanantion! Just started learning about Machine Learning algorithms and this is incredibly helpful. Thank you!

  • @amandal8404
    @amandal8404 3 года назад

    Wow, great intro to cluster analysis in Python. Thank you so much, awesome teaching as always!

  • @spacetimevideostudio109
    @spacetimevideostudio109 2 года назад

    Thank you so much Dhaval for this video, with my elbow technique I got k=3.
    Thanks

  • @Suigeneris44
    @Suigeneris44 5 лет назад

    You are really good! I would be happy to pay for such clear code lectures. Very well articulated! Keep it up!

    • @codebasics
      @codebasics  5 лет назад

      Suigeneris44, I appreciate your comment buddy. I am glad you found this to be useful :)

  • @henyermogollon679
    @henyermogollon679 2 года назад

    God bless you. You are ML Guru! I love your content. very easy to understand the basics of everything.

  • @poojabehera8675
    @poojabehera8675 4 года назад +1

    Thank you so so much for making Machine learning so easy to understand by the series sir. The more i look for any ML content of yours, the more i wish to go on for the entire series with such clear understanding. with passion for the subject & curiosity to search had been gone through so many tutorials so far but codebasics is the best learning source for beginners like me and would definitely recommend this to freshers/ beginners for a clear base understanding for data science.... MUCH APPRECIATE

    • @codebasics
      @codebasics  4 года назад +1

      Thanks Pooja for your kind words. This means a lot to me and gives me a fuel to continue my work. If you like my videos would you share this series and deep learning series on your facebook page, linked in or watsapp? That way maximum people can benefit from it.

    • @sajjadkhan-oc2bk
      @sajjadkhan-oc2bk 3 года назад

      @@codebasics Thanks for your efforts! Stay blessed...

  • @mohankrishna1680
    @mohankrishna1680 3 года назад

    huge respect to your hardwork , vedios increasing learning curiosity 👏👏👏👏

  • @techienomadiso8970
    @techienomadiso8970 3 года назад +1

    Wow. You are a great man. You've made it soo simple to understand. Thank you Sir. 🔥🔥🔥

  • @AlonAvramson
    @AlonAvramson 3 года назад +1

    Thank you! really enjoyed this session. I tried both Petal and Sepal and it went very well.

  • @thirugnanamselvam2304
    @thirugnanamselvam2304 5 лет назад +5

    All your videos are clear and good. Congrats for that. Can you please make a video for recommender systems and NLP

    • @codebasics
      @codebasics  5 лет назад +3

      Thanks thirugnanam, point noted!

  • @monfreign
    @monfreign 4 года назад

    been researching about these regressions and other methods, have always found myself in your vids, you sir earned my sub :)

  • @abhijitkundargi150
    @abhijitkundargi150 4 года назад +2

    Amazed!!! Understood the concept in just one go! Hands on is by far the best I ever saw.. Keep up the good work Sir, please post more videos majorly used algorithms. Thank you.

  • @vikrampruthvi5
    @vikrampruthvi5 5 лет назад +2

    Thanks a ton... I love your simplicity in explanation and perfection in explaining hurdles that everyone might face. Please keep doing this great work.

  • @jiatianbu6761
    @jiatianbu6761 3 года назад

    Make Machine Learning so easy to understand. Thx

  • @thaanathaana4522
    @thaanathaana4522 11 месяцев назад

    Really useful videos .. i got too many doubts in machine learning.. came up with one video became a subscriber now .. thanks brother for clear explanation

  • @AntonioGarcia-ck5hy
    @AntonioGarcia-ck5hy 2 года назад

    Thanks a lot for the tutorial video, @codebasics. You are an excellent teacher.

  • @AjaySharma-jv6qn
    @AjaySharma-jv6qn 3 года назад

    You make things quite simple. Please keep posting..

  • @beansgoya
    @beansgoya 5 лет назад +3

    not sure if anyone else had this problem but at 16:00, i had to add an extra set of brackets when i did this exercise. maybe my python is outdated or something.
    scaler = MinMaxScaler()
    scaler.fit(df[['Income($)']])
    df['Income($)'] = scaler.transform(df[['Income($)']])
    df

    • @codebasics
      @codebasics  5 лет назад

      Kin, what you are doing is correct. In tutorial I got warning but ignored it but yea it takes 2D array as input. Here is my correct code: github.com/codebasics/py/blob/master/ML/13_kmeans/13_kmeans_tutorial.ipynb

    • @kale_hyder
      @kale_hyder 4 года назад

      Kin Cheng thank you so much

  • @neerajkulhari3964
    @neerajkulhari3964 Год назад

    Wow..
    What a nice explanation!
    Thank you for such a nice video

  • @ousmanealamakaba3135
    @ousmanealamakaba3135 2 года назад

    you are very strong .thank you so much for making this class easy

  • @Ankurkumar14680
    @Ankurkumar14680 5 лет назад +3

    Another excellent video Sir, it is difficult to wait to see your videos on Neural Networks...as you mentioned in the comments below. thanks a ton for your efforts

  • @shivamtyagi5614
    @shivamtyagi5614 4 года назад

    Exercise done. viewing the initial plot n_clusters seems equal to 2, bt using ellbow method clears it to use n_clusters =3,,,,,Enjoying this holiday!!!!!!!!!!

  • @franky0226
    @franky0226 4 года назад

    thank you so much !
    congrats for 100K !!

  • @ramkumars4658
    @ramkumars4658 4 года назад

    How will I forget to give a thumbs up?🤣😂.The video was sooo useful and very simple but effective.I understood k-means clustering and Elbow methods.Thank you for posting such a useful video.

  • @dathscom
    @dathscom Год назад

    You are awesome man, thanks a lot. Keep on sharing your significant educative videos, please.

  • @-NagumantryRaghuveer
    @-NagumantryRaghuveer 2 года назад

    best tutorials for Machine learning

  • @nishiraju6359
    @nishiraju6359 4 года назад

    The way explained, it really understandable... Keep uploading more n more videos on ML .. with Case Study .. Thanks in Advance

  • @kmnm9463
    @kmnm9463 4 года назад

    Hi Dhaval ji - excellent video on KMC. Very precise in presenting, Particularly liked the cluster_centers_ and inertia_ concepts. The final elbow plot with for loop being the starting point was unparalleled in clarity. Thanks a lot

  • @sharathkrishnan1558
    @sharathkrishnan1558 4 года назад

    Excellent, amazing . You make it so easy. Thank you sir

  • @liliyalopez8998
    @liliyalopez8998 2 года назад

    I love how you explained the material in plain language. You made it very easy to follow and understand ❤

  • @simaykazc1508
    @simaykazc1508 4 года назад

    Very clean explanatıons. Thank you. You should be more visible on RUclips!

  • @aviralgupta9364
    @aviralgupta9364 4 года назад +1

    Fantastic tutorial !!! .Thanks a lot sir ... It gives best explanation

  • @rakeshmurali2342
    @rakeshmurali2342 3 года назад

    Beautiful! Superbly explained!

  • @mathwithpunam
    @mathwithpunam 2 года назад +1

    sir in exercise portion..is any type of scaling required?

  • @dineshpabbi7005
    @dineshpabbi7005 5 лет назад +2

    Sir , I found your channel just a week ago and i would just like to thank you so much for such a wonderful content ! Please continue the ML series .. I hope you also make tutorial of Neural Networks and their application!

  • @Saikumer-g4p
    @Saikumer-g4p 8 месяцев назад

    Awesome explanation from you sir,I think this is best tutorial for k means clusters in the youtube . I tried seen lot of videos in the RUclips regrading on the this topic . But this video give me some boost to create the amazing the model in ml tq for all this sir .
    My feedback is : you shoud give the some more example on topics that will be help to us to make beautiful things from this

  • @bugBusters1192
    @bugBusters1192 2 года назад

    Really must appreciate the playlist 😌

  • @sushiltry
    @sushiltry 3 года назад +1

    Superb explanation but I feel elbow plot is to be drawn initially so it is more clear about K

  • @suhaalam2127
    @suhaalam2127 2 года назад

    Thank you so much for such well explained tutorials.

  • @bishwadeepsikder3018
    @bishwadeepsikder3018 Год назад

    The best explanation ever... Thank you so much

  • @amitblizer4567
    @amitblizer4567 Год назад

    Very clearly explained video! Thank u very much!

  • @amrelkholy6662
    @amrelkholy6662 3 года назад

    you are amazing, I like your simplicity in delivering the information, thank you very much

  • @R3NAN3224
    @R3NAN3224 4 года назад +5

    If you have more than 2 atributes use.. df([[ 'name', 'example]] >X ,[[ 'name', 'example]] >Y )

    • @paulcurious2324
      @paulcurious2324 3 года назад +1

      i dont get this please could you explain in detail

    • @R3NAN3224
      @R3NAN3224 3 года назад

      @@paulcurious2324 @Paul Curious hi, if you have 3 atributes.. For example: color, leaf type and flower. You need make a code using 3 separated arrays.. Inside df( [ [ 'color','green'] ],[ [ 'Leaf','small'] ] ,[ ['flower','white']] )

    • @paulcurious2324
      @paulcurious2324 3 года назад +1

      @@R3NAN3224 it says df is not a callable when i do that

    • @paulcurious2324
      @paulcurious2324 3 года назад +1

      @@R3NAN3224 can u send a link to an example, maybe github or repl

    • @R3NAN3224
      @R3NAN3224 3 года назад +1

      @@paulcurious2324 see in 8:00 ... df is a name associate of your database. Paste your code here to i see you database name.

  • @shreyatangri2381
    @shreyatangri2381 3 года назад

    Very Very Good tutorial! You have explained each and every concept very nicely. Thank you so much😌😌😌

  • @datastako156
    @datastako156 3 года назад

    very nice video sir and easy to understand.. thank you and more power!

  • @anmoldeep0123
    @anmoldeep0123 10 месяцев назад

    What a fantastic way to expain this algorithm ? What are the practical usecases of this algo ?

  • @LoneTree262
    @LoneTree262 3 года назад

    Great video. I am still learning and found this very helpful.

  • @ericwr4965
    @ericwr4965 4 года назад +4

    This was brilliant and I appreciate the explanation of the code.
    Question, once you get the clusters identified as you took age and income, what would you explain?
    Would you need the table as well to discuss the pattern as a supplement as otherwise we would just say we have three clusters, but what do they mean?