SlideShare a Scribd company logo
1 of 29
K MEANS CLUSTERIN
INSTRUCTOR NAME: MD. SHOHEL ARMAN
K-means clustering is a simple and elegant approach for
partitioning a
data set into K distinct, non-overlapping clusters. To perform
K-means
clustering, we must first specify the desired number of
clusters K; then the
K-means algorithm will assign each observation to exactly
one of the K
clusters
The K-means algorithm clusters data by
trying to separate samples in n groups of
equal variance, minimizing a criterion known
as the inertia or within-cluster sum-of-
squares. The K-means algorithm aims to
choose centroid that minimize the inertia,
or within-cluster sum-of-squares criterion
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
HOW
K MEANS
ALGORITHM
WORKS?
Step 1. Determine the value “K”, the value “K”
represents the number of clusters.
in this case, we’ll select K=3. That is to say, we want to
identify 3 clusters. Is there any way to determine the value
of K? yes there is, but we’ll talk later about it.
Step 2. Randomly select 3 distinct centroid (new data
points as cluster initialization)
for example — attempts 1. “K” is equal 3 so there are 3
centroid, in which case it will be the cluster initialization
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
HOW
K MEANS
ALGORITHM
WORKS?
Step 3. Measure the distance (Euclidean distance)
between each point and the centroid
for example, measure the distance between first point and
the centroid.
HOW
K MEANS
ALGORITHM
WORKS?
Step 4. Assign the each point to the nearest cluster
for example, measure the distance between first point
and the centroid.
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
HOW
K MEANS
ALGORITHM
WORKS?
Step 5. Calculate the mean of each cluster as new
centroid
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
HOW
K MEANS
ALGORITHM
WORKS?
Step 6. Repeat step 3–5 with the new center of
cluster
Repeat until stop:
•Convergence. (No further changes)
•Maximum number of iterations.
Since the clustering did not change at all during the last iteration, we’re
done.
Has this process been completed? of course not
Remember, the K-means algorithm aims to choose centroid that
minimise the inertia, or within-cluster sum-of-squares criterion
So, how to assess the results of this clustering? let’s continue
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
HOW
K MEANS
ALGORITHM
WORKS?
Step 7. Calculate the variance of each cluster
Since K-means clustering can’t “see” the best clustering, it is only option
is to keep track of these clusters, and their total variance, and do the
whole thing over again with different starting points.
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
HOW
K MEANS
ALGORITHM
WORKS?
Step 8. Repeat step 2–7 until get the lowest sum
of variance
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
HOW
K MEANS
ALGORITHM
WORKS?
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
HOW
K MEANS
ALGORITHM
WORKS?
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
K MEANS
CLUSTERING
OVERVIEW
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
IMPORTING KNN
LIBRARIES
Required modules from python for importing KNN
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
K MEANS
CLUSTERING
OVERVIEW
Clustering with two
feature
Clustering with three
feature
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
ADVANTAGES
OF K MEANS
CLUSTURING
• Relatively simple to implement.
• Scales to large data sets.
• Guarantees convergence.
• Can warm-start the positions of centroids.
• Easily adapts to new examples.
• Generalizes to clusters of different shapes and sizes,
such as elliptical clusters.
Step 2. Randomly select 3
distinct centroid (new data
points as cluster
initialization)
for example — attempts 1.
“K” is equal 3 so there are 3
centroid, in which case it will
be the cluster initialization
DISADVANTAGES
OF K MEANS
CLUSTURING
• Choosing manually.
• Being dependent on initial values.
• Clustering data of varying sizes and density.
• Clustering outliers.
• Scaling with number of dimensions.
THANK
YOU

More Related Content

Similar to K MEANS CLUSTERING (1).pptx

Lecture8 clustering
Lecture8 clusteringLecture8 clustering
Lecture8 clusteringsidsingh680
 
K-Means clustring @jax
K-Means clustring @jaxK-Means clustring @jax
K-Means clustring @jaxAjay Iet
 
Slide-TIF311-DM-10-11.ppt
Slide-TIF311-DM-10-11.pptSlide-TIF311-DM-10-11.ppt
Slide-TIF311-DM-10-11.pptSandinoBerutu1
 
Slide-TIF311-DM-10-11.ppt
Slide-TIF311-DM-10-11.pptSlide-TIF311-DM-10-11.ppt
Slide-TIF311-DM-10-11.pptImXaib
 
CSA 3702 machine learning module 3
CSA 3702 machine learning module 3CSA 3702 machine learning module 3
CSA 3702 machine learning module 3Nandhini S
 
Unsupervised Learning
Unsupervised LearningUnsupervised Learning
Unsupervised LearningAlia Hamwi
 
K-Means Clustering Algorithm.pptx
K-Means Clustering Algorithm.pptxK-Means Clustering Algorithm.pptx
K-Means Clustering Algorithm.pptxJebaRaj26
 
Clustering & classification
Clustering & classificationClustering & classification
Clustering & classificationJamshed Khan
 
CLUSTERING IN DATA MINING.pdf
CLUSTERING IN DATA MINING.pdfCLUSTERING IN DATA MINING.pdf
CLUSTERING IN DATA MINING.pdfSowmyaJyothi3
 
MODULE 4_ CLUSTERING.pptx
MODULE 4_ CLUSTERING.pptxMODULE 4_ CLUSTERING.pptx
MODULE 4_ CLUSTERING.pptxnikshaikh786
 
Clustering techniques
Clustering techniquesClustering techniques
Clustering techniquestalktoharry
 
K means clustering algorithm
K means clustering algorithmK means clustering algorithm
K means clustering algorithmDarshak Mehta
 
Evaluation of programs codes using machine learning
Evaluation of programs codes using machine learningEvaluation of programs codes using machine learning
Evaluation of programs codes using machine learningVivek Maskara
 
K Means Clustering Algorithm | K Means Clustering Example | Machine Learning ...
K Means Clustering Algorithm | K Means Clustering Example | Machine Learning ...K Means Clustering Algorithm | K Means Clustering Example | Machine Learning ...
K Means Clustering Algorithm | K Means Clustering Example | Machine Learning ...Simplilearn
 
Training machine learning k means 2017
Training machine learning k means 2017Training machine learning k means 2017
Training machine learning k means 2017Iwan Sofana
 

Similar to K MEANS CLUSTERING (1).pptx (20)

K means clustring @jax
K means clustring @jaxK means clustring @jax
K means clustring @jax
 
kmean clustering
kmean clusteringkmean clustering
kmean clustering
 
Lecture8 clustering
Lecture8 clusteringLecture8 clustering
Lecture8 clustering
 
K-Means clustring @jax
K-Means clustring @jaxK-Means clustring @jax
K-Means clustring @jax
 
Slide-TIF311-DM-10-11.ppt
Slide-TIF311-DM-10-11.pptSlide-TIF311-DM-10-11.ppt
Slide-TIF311-DM-10-11.ppt
 
Slide-TIF311-DM-10-11.ppt
Slide-TIF311-DM-10-11.pptSlide-TIF311-DM-10-11.ppt
Slide-TIF311-DM-10-11.ppt
 
CSA 3702 machine learning module 3
CSA 3702 machine learning module 3CSA 3702 machine learning module 3
CSA 3702 machine learning module 3
 
Unsupervised Learning
Unsupervised LearningUnsupervised Learning
Unsupervised Learning
 
Neural nw k means
Neural nw k meansNeural nw k means
Neural nw k means
 
K-Means Clustering Algorithm.pptx
K-Means Clustering Algorithm.pptxK-Means Clustering Algorithm.pptx
K-Means Clustering Algorithm.pptx
 
Clustering & classification
Clustering & classificationClustering & classification
Clustering & classification
 
CLUSTERING IN DATA MINING.pdf
CLUSTERING IN DATA MINING.pdfCLUSTERING IN DATA MINING.pdf
CLUSTERING IN DATA MINING.pdf
 
K Means Clustering in ML.pptx
K Means Clustering in ML.pptxK Means Clustering in ML.pptx
K Means Clustering in ML.pptx
 
MODULE 4_ CLUSTERING.pptx
MODULE 4_ CLUSTERING.pptxMODULE 4_ CLUSTERING.pptx
MODULE 4_ CLUSTERING.pptx
 
Clustering techniques
Clustering techniquesClustering techniques
Clustering techniques
 
Clustering
ClusteringClustering
Clustering
 
K means clustering algorithm
K means clustering algorithmK means clustering algorithm
K means clustering algorithm
 
Evaluation of programs codes using machine learning
Evaluation of programs codes using machine learningEvaluation of programs codes using machine learning
Evaluation of programs codes using machine learning
 
K Means Clustering Algorithm | K Means Clustering Example | Machine Learning ...
K Means Clustering Algorithm | K Means Clustering Example | Machine Learning ...K Means Clustering Algorithm | K Means Clustering Example | Machine Learning ...
K Means Clustering Algorithm | K Means Clustering Example | Machine Learning ...
 
Training machine learning k means 2017
Training machine learning k means 2017Training machine learning k means 2017
Training machine learning k means 2017
 

More from kibriaswe

07. LU Decomposition.pptx
07. LU Decomposition.pptx07. LU Decomposition.pptx
07. LU Decomposition.pptxkibriaswe
 
06. Gaussian Elimination.pptx
06. Gaussian Elimination.pptx06. Gaussian Elimination.pptx
06. Gaussian Elimination.pptxkibriaswe
 
webpresentation.pptx
webpresentation.pptxwebpresentation.pptx
webpresentation.pptxkibriaswe
 
E-learning_3.0(1).pptx
E-learning_3.0(1).pptxE-learning_3.0(1).pptx
E-learning_3.0(1).pptxkibriaswe
 
Decision Tree.pptx
Decision Tree.pptxDecision Tree.pptx
Decision Tree.pptxkibriaswe
 
K MEANS CLUSTERING.pptx
K MEANS CLUSTERING.pptxK MEANS CLUSTERING.pptx
K MEANS CLUSTERING.pptxkibriaswe
 
KNN(K NEAREST NEIGHBOURS).pptx
KNN(K NEAREST NEIGHBOURS).pptxKNN(K NEAREST NEIGHBOURS).pptx
KNN(K NEAREST NEIGHBOURS).pptxkibriaswe
 

More from kibriaswe (7)

07. LU Decomposition.pptx
07. LU Decomposition.pptx07. LU Decomposition.pptx
07. LU Decomposition.pptx
 
06. Gaussian Elimination.pptx
06. Gaussian Elimination.pptx06. Gaussian Elimination.pptx
06. Gaussian Elimination.pptx
 
webpresentation.pptx
webpresentation.pptxwebpresentation.pptx
webpresentation.pptx
 
E-learning_3.0(1).pptx
E-learning_3.0(1).pptxE-learning_3.0(1).pptx
E-learning_3.0(1).pptx
 
Decision Tree.pptx
Decision Tree.pptxDecision Tree.pptx
Decision Tree.pptx
 
K MEANS CLUSTERING.pptx
K MEANS CLUSTERING.pptxK MEANS CLUSTERING.pptx
K MEANS CLUSTERING.pptx
 
KNN(K NEAREST NEIGHBOURS).pptx
KNN(K NEAREST NEIGHBOURS).pptxKNN(K NEAREST NEIGHBOURS).pptx
KNN(K NEAREST NEIGHBOURS).pptx
 

Recently uploaded

Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...HyderabadDolls
 
Vastral Call Girls Book Now 7737669865 Top Class Escort Service Available
Vastral Call Girls Book Now 7737669865 Top Class Escort Service AvailableVastral Call Girls Book Now 7737669865 Top Class Escort Service Available
Vastral Call Girls Book Now 7737669865 Top Class Escort Service Availablegargpaaro
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...gajnagarg
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareGraham Ware
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxchadhar227
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubaikojalkojal131
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraGovindSinghDasila
 
💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...
💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...
💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...vershagrag
 
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...gajnagarg
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...gajnagarg
 
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...kumargunjan9515
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制vexqp
 
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...HyderabadDolls
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRajesh Mondal
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...Elaine Werffeli
 
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...HyderabadDolls
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numberssuginr1
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...nirzagarg
 
Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?RemarkSemacio
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...nirzagarg
 

Recently uploaded (20)

Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
 
Vastral Call Girls Book Now 7737669865 Top Class Escort Service Available
Vastral Call Girls Book Now 7737669865 Top Class Escort Service AvailableVastral Call Girls Book Now 7737669865 Top Class Escort Service Available
Vastral Call Girls Book Now 7737669865 Top Class Escort Service Available
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - Almora
 
💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...
💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...
💞 Safe And Secure Call Girls Agra Call Girls Service Just Call 🍑👄6378878445 🍑...
 
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Nandurbar [ 7014168258 ] Call Me For Genuine Models...
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...Top Call Girls in Balaghat  9332606886Call Girls Advance Cash On Delivery Ser...
Top Call Girls in Balaghat 9332606886Call Girls Advance Cash On Delivery Ser...
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
Kalyani ? Call Girl in Kolkata | Service-oriented sexy call girls 8005736733 ...
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbers
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?Case Study 4 Where the cry of rebellion happen?
Case Study 4 Where the cry of rebellion happen?
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 

K MEANS CLUSTERING (1).pptx

  • 1. K MEANS CLUSTERIN INSTRUCTOR NAME: MD. SHOHEL ARMAN
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. K-means clustering is a simple and elegant approach for partitioning a data set into K distinct, non-overlapping clusters. To perform K-means clustering, we must first specify the desired number of clusters K; then the K-means algorithm will assign each observation to exactly one of the K clusters
  • 14. The K-means algorithm clusters data by trying to separate samples in n groups of equal variance, minimizing a criterion known as the inertia or within-cluster sum-of- squares. The K-means algorithm aims to choose centroid that minimize the inertia, or within-cluster sum-of-squares criterion
  • 15. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization HOW K MEANS ALGORITHM WORKS? Step 1. Determine the value “K”, the value “K” represents the number of clusters. in this case, we’ll select K=3. That is to say, we want to identify 3 clusters. Is there any way to determine the value of K? yes there is, but we’ll talk later about it. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization
  • 16. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization HOW K MEANS ALGORITHM WORKS? Step 3. Measure the distance (Euclidean distance) between each point and the centroid for example, measure the distance between first point and the centroid.
  • 17. HOW K MEANS ALGORITHM WORKS? Step 4. Assign the each point to the nearest cluster for example, measure the distance between first point and the centroid.
  • 18. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization HOW K MEANS ALGORITHM WORKS? Step 5. Calculate the mean of each cluster as new centroid
  • 19. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization HOW K MEANS ALGORITHM WORKS? Step 6. Repeat step 3–5 with the new center of cluster Repeat until stop: •Convergence. (No further changes) •Maximum number of iterations. Since the clustering did not change at all during the last iteration, we’re done. Has this process been completed? of course not Remember, the K-means algorithm aims to choose centroid that minimise the inertia, or within-cluster sum-of-squares criterion So, how to assess the results of this clustering? let’s continue
  • 20. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization HOW K MEANS ALGORITHM WORKS? Step 7. Calculate the variance of each cluster Since K-means clustering can’t “see” the best clustering, it is only option is to keep track of these clusters, and their total variance, and do the whole thing over again with different starting points.
  • 21. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization HOW K MEANS ALGORITHM WORKS? Step 8. Repeat step 2–7 until get the lowest sum of variance
  • 22. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization HOW K MEANS ALGORITHM WORKS?
  • 23. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization HOW K MEANS ALGORITHM WORKS?
  • 24. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization K MEANS CLUSTERING OVERVIEW
  • 25. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization IMPORTING KNN LIBRARIES Required modules from python for importing KNN
  • 26. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization K MEANS CLUSTERING OVERVIEW Clustering with two feature Clustering with three feature
  • 27. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization ADVANTAGES OF K MEANS CLUSTURING • Relatively simple to implement. • Scales to large data sets. • Guarantees convergence. • Can warm-start the positions of centroids. • Easily adapts to new examples. • Generalizes to clusters of different shapes and sizes, such as elliptical clusters.
  • 28. Step 2. Randomly select 3 distinct centroid (new data points as cluster initialization) for example — attempts 1. “K” is equal 3 so there are 3 centroid, in which case it will be the cluster initialization DISADVANTAGES OF K MEANS CLUSTURING • Choosing manually. • Being dependent on initial values. • Clustering data of varying sizes and density. • Clustering outliers. • Scaling with number of dimensions.