Machine Learning Tutorial Python - 13: K Means Clustering Algorithm

  Рет қаралды 637,962

codebasics

codebasics

Күн бұрын

K Means clustering algorithm is unsupervised machine learning technique used to cluster data points. In this tutorial we will go over some theory behind how k means works and then solve income group clustering problem using sklearn, kmeans and python. Elbow method is a technique used to determine optimal number of k, we will review that method as well.
#MachineLearning #PythonMachineLearning #MachineLearningTutorial #Python #PythonTutorial #PythonTraining #MachineLearningCource #kmeans #MachineLearningTechnique #sklearn #sklearntutorials #scikitlearntutorials
Code: github.com/codebasics/py/blob...
data link: github.com/codebasics/py/tree...
Exercise solution: github.com/codebasics/py/blob...
Topics that are covered in this Video:
0:00 introduction
0:08 Theory - Explanation of Supervised vs Unsupervised learning and how kmeans clustering works. kmeans is unsupervised learning
5:00 Elbow method
7:33 Coding (start) (Cluster people income based on age)
9:38 sklearn.cluster KMeans model creation and training
14:56 Use MinMaxScaler from sklearn
24:07 Exercise (Cluster iris flowers using their petal width and length)
Do you want to learn technology from me? Check codebasics.io/?... for my affordable video courses.
Next Video:
Machine Learning Tutorial Python - 14: Naive Bayes Part 1: • Machine Learning Tutor...
Popular Playlist:
Data Science Full Course: • Data Science Full Cour...
Data Science Project: • Machine Learning & Dat...
Machine learning tutorials: • Machine Learning Tutor...
Pandas: • Python Pandas Tutorial...
matplotlib: • Matplotlib Tutorial 1 ...
Python: • Why Should You Learn P...
Jupyter Notebook: • What is Jupyter Notebo...
Tools and Libraries:
Scikit learn tutorials
Sklearn tutorials
Machine learning with scikit learn tutorials
Machine learning with sklearn tutorials
To download csv and code for all tutorials: go to github.com/codebasics/py, click on a green button to clone or download the entire repository and then go to relevant folder to get access to that specific file.
🌎 My Website For Video Courses: codebasics.io/?...
Need help building software or data analytics and AI solutions? My company www.atliq.com/ can help. Click on the Contact button on that website.
#️⃣ Social Media #️⃣
🔗 Discord: / discord
📸 Dhaval's Personal Instagram: / dhavalsays
📸 Instagram: / codebasicshub
🔊 Facebook: / codebasicshub
📱 Twitter: / codebasicshub
📝 Linkedin: / codebasics

Пікірлер: 598
@codebasics
@codebasics 2 жыл бұрын
To learn AI concepts in a simplified and practical manner check our course "AI for everyone": codebasics.io/courses/ai-for-everyone-your-first-step-towards-ai Do you want to learn technology from me? Check codebasics.io/ for my affordable video courses.
@vitaltopics316
@vitaltopics316 Жыл бұрын
why do we not need to use centroids for the iris dataset?
@hshrestha2811
@hshrestha2811 3 жыл бұрын
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 2 жыл бұрын
Noted!
@akilanebcas2700
@akilanebcas2700 2 жыл бұрын
Super
@mychanneltest8623
@mychanneltest8623 Жыл бұрын
7. done and put the ruler away
@ganeshn9464
@ganeshn9464 6 ай бұрын
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 ?
@shauryabhatnagar71
@shauryabhatnagar71 3 жыл бұрын
You are probably one of the best teachers I have come across. Thank you so much!
@arrahman100
@arrahman100 5 жыл бұрын
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.
@cindinishimoto9528
@cindinishimoto9528 4 жыл бұрын
All the ML series is so exciting. I'm learning and having fun during the quarantine in Brazil, SP. Thanks, @codebasics
@AltafAnsari-tf9nl
@AltafAnsari-tf9nl 3 жыл бұрын
I have started loving machine learning due to the simplicity of explanations.
@amilcarc.dasilva5665
@amilcarc.dasilva5665 5 жыл бұрын
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.
@aliouahli3185
@aliouahli3185 Жыл бұрын
you can't find a video and not watch all playlists , im so grateful to you , thank you sir!
@adisaolaitan5475
@adisaolaitan5475 5 жыл бұрын
Thanks so much for your easy-to-understand tutorials. You are a blessing. God bless you!
@Mukeshsingh-zn9rq
@Mukeshsingh-zn9rq 3 жыл бұрын
was trying out tons of videos trying to understand the basics of ML, you made it so simple and quick. Loved it!!
@codebasics
@codebasics 3 жыл бұрын
😊👍
@namansinghal9090
@namansinghal9090 3 жыл бұрын
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.
@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.
@Kingsohio
@Kingsohio 2 жыл бұрын
This is a great quick refresher for those with the basic knowledge of ML clustering algorithms
@wyphonema4024
@wyphonema4024 3 жыл бұрын
my grad school professor explains this very badly. You explain things very well with patience, you are the definition of a good teacher
@codebasics
@codebasics 3 жыл бұрын
glad you liked it :)
@monfreign
@monfreign 3 жыл бұрын
been researching about these regressions and other methods, have always found myself in your vids, you sir earned my sub :)
@dineshpabbi7005
@dineshpabbi7005 5 жыл бұрын
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!
@nilupulperera
@nilupulperera 4 жыл бұрын
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 жыл бұрын
Dear Nilpul, Thanks for the comment. Keep learning. 😂
@beansgoya
@beansgoya 5 жыл бұрын
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 жыл бұрын
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 👍
@qas4273
@qas4273 4 жыл бұрын
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 3 жыл бұрын
Thanks for this 👍
@codebasics
@codebasics 3 күн бұрын
Yes, with seaborn you can do it in one line. Thanks for posting this comment 🙏🏼🙏🏼
@saratbabum1303
@saratbabum1303 4 жыл бұрын
Nice way of explaining the complicated concept with an example. Great Job !!! Thanks a lot
@franky0226
@franky0226 4 жыл бұрын
thank you so much ! congrats for 100K !!
@86Plum
@86Plum 3 жыл бұрын
Amazing video and explanantion! Just started learning about Machine Learning algorithms and this is incredibly helpful. Thank you!
@praveenjagarlapudi7891
@praveenjagarlapudi7891 Жыл бұрын
I have got the real clarity after watching your video, This is a great help. Thank you for all the videos.
@skyblue021
@skyblue021 3 жыл бұрын
This is the best-explained K-means on the internet - period. Thank you!
@codebasics
@codebasics 3 жыл бұрын
Glad it was helpful!
@shubhamwaingade4144
@shubhamwaingade4144 2 жыл бұрын
It was good, simple, informative, no errors. I guess these are enough clusters to define the quality of this video.
@andreabrunelli2030
@andreabrunelli2030 2 жыл бұрын
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 2 жыл бұрын
Glad it helped you 😊
@commercial3750
@commercial3750 9 ай бұрын
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!
@codebasics
@codebasics 9 ай бұрын
Glad it was helpful!
@Ankurkumar14680
@Ankurkumar14680 5 жыл бұрын
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
@bhaskarg8438
@bhaskarg8438 2 жыл бұрын
your explanation is clear and clarity in the content.. and knowledge sharing to needed Data Science community is Nobel... thankyou... 🙏
@akshrags-mindmaze3407
@akshrags-mindmaze3407 Жыл бұрын
7:25 Brilliant Explaination!
@henyermogollon679
@henyermogollon679 2 жыл бұрын
God bless you. You are ML Guru! I love your content. very easy to understand the basics of everything.
@zainishah5540
@zainishah5540 2 жыл бұрын
Oh man just wow wow wow. You made my day what a lesson it was. Absolutely you nailed it
@amandal8404
@amandal8404 3 жыл бұрын
Wow, great intro to cluster analysis in Python. Thank you so much, awesome teaching as always!
@codebasics
@codebasics 3 жыл бұрын
Glad it was helpful!
@dathscom
@dathscom Жыл бұрын
You are awesome man, thanks a lot. Keep on sharing your significant educative videos, please.
@leamon9024
@leamon9024 4 жыл бұрын
Thanks again for the tutorials. Really amazing.
@mohankrishna1680
@mohankrishna1680 2 жыл бұрын
huge respect to your hardwork , vedios increasing learning curiosity 👏👏👏👏
@maruthiprasad8184
@maruthiprasad8184 2 жыл бұрын
Optimal value for iris data set got 3. Thank you very much for simple & great explanation.
@doyoonkim4187
@doyoonkim4187 2 жыл бұрын
The best ML lesson I've ever heard
@AntonioGarcia-ck5hy
@AntonioGarcia-ck5hy Жыл бұрын
Thanks a lot for the tutorial video, @codebasics. You are an excellent teacher.
@amitblizer4567
@amitblizer4567 Жыл бұрын
Very clearly explained video! Thank u very much!
@jayagrawal3481
@jayagrawal3481 5 ай бұрын
really liking the course i cant believe i already watched more than 50 videos from a playlist only 50 more to go
@raom2127
@raom2127 2 жыл бұрын
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........................
@NikitaSharma-bs4gg
@NikitaSharma-bs4gg Жыл бұрын
I searched for 3-4 days and I only got the plotting after seeing your video- Thanks a lot
@shantanuraj7086
@shantanuraj7086 2 жыл бұрын
Amazing video. Creative, resourceful and excellent preparation. Keep posting more such videos.
@bishwadeepsikder3018
@bishwadeepsikder3018 10 ай бұрын
The best explanation ever... Thank you so much
@sunilsharanappa7721
@sunilsharanappa7721 3 жыл бұрын
You are awesome, you make the complex things simplified.Please keep up the good work.
@codebasics
@codebasics 3 жыл бұрын
Thanks, will do!
@simranthiara6616
@simranthiara6616 3 жыл бұрын
Best channel for explanations on ML algorithms. Thank you so much :) , definitely subscribed .
@codebasics
@codebasics 3 жыл бұрын
Thanks and welcome
@atifmalayalam4007
@atifmalayalam4007 Ай бұрын
Very clear. Thanks!
@pnardogan4848
@pnardogan4848 3 жыл бұрын
very well explained. Thank ou for this great tutorial!
@Milton7141
@Milton7141 3 жыл бұрын
As always my friend , excelent video !
@abhishek4985
@abhishek4985 2 жыл бұрын
Saw so many videos, but this one video helped the most. Thanks!
@codebasics
@codebasics 2 жыл бұрын
Glad it helped!
@sidduhedaginal
@sidduhedaginal 4 жыл бұрын
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 жыл бұрын
Thanks for you kind words and I am happy you liked it 😊
@shubhangiagrawal336
@shubhangiagrawal336 3 жыл бұрын
@@codebasics Sir can you please make one video on knn algorithm? I need it so badly. Thankyou
@Suigeneris44
@Suigeneris44 4 жыл бұрын
You are really good! I would be happy to pay for such clear code lectures. Very well articulated! Keep it up!
@codebasics
@codebasics 4 жыл бұрын
Suigeneris44, I appreciate your comment buddy. I am glad you found this to be useful :)
@mapa5000
@mapa5000 Жыл бұрын
Outstanding explanation my friend !! Thank you from Houston
@codebasics
@codebasics Жыл бұрын
👍👍😇
@praveensevenhills
@praveensevenhills 10 ай бұрын
great explanation taking from a small example and going in elaborative way covering whole concept in a nutshell very well explained
@tejas4054
@tejas4054 Жыл бұрын
This is best video of all ml videos on youtube
@neerajkulhari3964
@neerajkulhari3964 Жыл бұрын
Wow.. What a nice explanation! Thank you for such a nice video
@sharathkrishnan1558
@sharathkrishnan1558 3 жыл бұрын
Excellent, amazing . You make it so easy. Thank you sir
@spacetimevideostudio109
@spacetimevideostudio109 Жыл бұрын
Thank you so much Dhaval for this video, with my elbow technique I got k=3. Thanks
@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.
@arulsebastian6338
@arulsebastian6338 4 жыл бұрын
Thanks for explaining & exercise. I love this video.
@shashankkkk
@shashankkkk 2 жыл бұрын
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 2 жыл бұрын
Thanks for your appreciation, sure when I am in India I will plan for a Meetup
@pk_officl
@pk_officl 3 жыл бұрын
Super sir🤩🤩🤩🤩. That's awesome!!! Thank you for your teaching 🤗. I have cleared What this is exactly!
@rithikaraj4687
@rithikaraj4687 2 жыл бұрын
Excellent tutorial sir. Thank you soo much.
@flyingsalmon
@flyingsalmon Жыл бұрын
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 Жыл бұрын
Glad you enjoyed it!
@flyingsalmon
@flyingsalmon Жыл бұрын
@@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!
@shara6281
@shara6281 2 жыл бұрын
Thanks a lot, great as all the other videos
@jakecalhoun1842
@jakecalhoun1842 2 жыл бұрын
Really clearly explained video thanks!
@heaven3279
@heaven3279 3 жыл бұрын
Excellent quick and short explanation of K-means. Appreciate it
@codebasics
@codebasics 3 жыл бұрын
Glad it was helpful!
@vikrampruthvi5
@vikrampruthvi5 5 жыл бұрын
Thanks a ton... I love your simplicity in explanation and perfection in explaining hurdles that everyone might face. Please keep doing this great work.
@prakashdahal2560
@prakashdahal2560 4 жыл бұрын
One of the most useful tutorial I have ever seen
@codebasics
@codebasics 4 жыл бұрын
🤓👍
@AjaySharma-jv6qn
@AjaySharma-jv6qn 2 жыл бұрын
You make things quite simple. Please keep posting..
@Mushsayer
@Mushsayer 2 жыл бұрын
Thanks a lot for the video. You taught the K-Means Clustering in 10 mins!
@codebasics
@codebasics 2 жыл бұрын
👍☺️
@optimalsolutionprogramming1299
@optimalsolutionprogramming1299 2 жыл бұрын
Great video. Thank you so much for your help!
@yoshidasan4780
@yoshidasan4780 Жыл бұрын
Sir,You are a living legend for sure ,such lectures with such awesome explanations....wow , hope we can meet you sir...anyways happy Independence day to all in advance!
@suhaalam2127
@suhaalam2127 2 жыл бұрын
Thank you so much for such well explained tutorials.
@naghmeheffat7757
@naghmeheffat7757 2 жыл бұрын
Beautiful, Brilliant
@utkarshtrivedi9866
@utkarshtrivedi9866 6 ай бұрын
great session! thank you.
@AlonAvramson
@AlonAvramson 2 жыл бұрын
Thank you! really enjoyed this session. I tried both Petal and Sepal and it went very well.
@codebasics
@codebasics 2 жыл бұрын
Glad you enjoyed it!
@jiatianbu6761
@jiatianbu6761 2 жыл бұрын
Make Machine Learning so easy to understand. Thx
@cesarcabanillas9373
@cesarcabanillas9373 2 жыл бұрын
Thank you so much, it is very helpful, simple and clearly!
@abhijitmalode3189
@abhijitmalode3189 4 жыл бұрын
thank u so much sir for this ml video it clearly understood by everyone , it clear my all doubt
@-NagumantryRaghuveer
@-NagumantryRaghuveer Жыл бұрын
best tutorials for Machine learning
@godza4735
@godza4735 Жыл бұрын
Thank you , you are the best just keep going ..
@content4553
@content4553 2 жыл бұрын
Very valuable inputs. Thanks for the effort.
@arunsagarsa3613
@arunsagarsa3613 2 жыл бұрын
pretty good videos man love the effort you put in.
@abhijitkundargi150
@abhijitkundargi150 4 жыл бұрын
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.
@fhcoder
@fhcoder 2 жыл бұрын
Thank you for this awesome video.
@durgaprasadvadlamoodi1271
@durgaprasadvadlamoodi1271 3 жыл бұрын
Excelle tutorial, Thank you very much
@ousmanealamakaba3135
@ousmanealamakaba3135 2 жыл бұрын
you are very strong .thank you so much for making this class easy
@allenjose6434
@allenjose6434 4 жыл бұрын
its very helpful. Thank you so much!
@thaanathaana4522
@thaanathaana4522 5 ай бұрын
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
@santetzuken8903
@santetzuken8903 3 жыл бұрын
These videos are more helpful than all of the classes I took in my university combined.
@codebasics
@codebasics 3 жыл бұрын
I am happy this was helpful to you.
@pandaparas8500
@pandaparas8500 5 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@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 😊
@aviralgupta9364
@aviralgupta9364 4 жыл бұрын
Fantastic tutorial !!! .Thanks a lot sir ... It gives best explanation
@ericwr4965
@ericwr4965 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?
@arthuki
@arthuki 4 жыл бұрын
Excellent material!
@ahmedadnanaziz2005
@ahmedadnanaziz2005 11 ай бұрын
what a great explanation , thanks teacher
@simaykazc1508
@simaykazc1508 3 жыл бұрын
Very clean explanatıons. Thank you. You should be more visible on KZbin!
@Sheblah1
@Sheblah1 9 ай бұрын
this is a perfect introduction to k-means thank you for making this video👌
@codebasics
@codebasics 9 ай бұрын
Glad you liked it!
@alexandermrkich8734
@alexandermrkich8734 2 жыл бұрын
Excellent, thank you.
Machine Learning Tutorial Python 12 - K Fold Cross Validation
25:20
Luck Decides My Future Again 🍀🍀🍀 #katebrush #shorts
00:19
Kate Brush
Рет қаралды 7 МЛН
小女孩把路人当成离世的妈妈,太感人了.#short #angel #clown
00:53
버블티로 체감되는 요즘 물가
00:16
진영민yeongmin
Рет қаралды 56 МЛН
МАМА И STANDOFF 2 😳 !FAKE GUN! #shorts
00:34
INNA SERG
Рет қаралды 2,8 МЛН
StatQuest: K-means clustering
8:31
StatQuest with Josh Starmer
Рет қаралды 1,6 МЛН
K-Means Clustering From Scratch in Python (Mathematical)
33:10
NeuralNine
Рет қаралды 29 М.
K-Means Clustering Algorithm with Python Tutorial
19:20
Andy McDonald
Рет қаралды 90 М.
Clustering: K-means and Hierarchical
17:23
Serrano.Academy
Рет қаралды 195 М.
Machine Learning Tutorial Python - 10  Support Vector Machine (SVM)
23:22
Luck Decides My Future Again 🍀🍀🍀 #katebrush #shorts
00:19
Kate Brush
Рет қаралды 7 МЛН