ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
1
DTS304TC: Machine Learning
Lecture 7: K-Means Clustering
Dr Kang Dang
D-5032, Taicang Campus
Kang.Dang@xjtlu.edu.cn
Tel: 88973341
2
Acknowledges
This set of lecture notes has been adapted from
materials originally provided by Christopher M.
Bishop¡¯s and Xin Chen.
Overview.
? K-means clustering
? Application of K-means clustering in image segmentation
4
Q&A
? What is clustering?
? What is one application of the clustering?
Old Faithful Data Set
Duration of eruption (minutes)
Time
between
eruptions
(minutes)
K-means Algorithm
? Goal: represent a data set in terms of K clusters each
of which is summarized by a prototype
? Initialize prototypes, then iterate between two phases:
? E-step (Cluster Assignment) : assign each data point to
nearest prototype
? M-step(Prototype update): update prototypes to be the
cluster means
? Simplest version is based on Euclidean distance
K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course
K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course
K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course
K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course
K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course
K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course
K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course
K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course
K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course
Responsibilities
? Responsibilities assign data points to clusters
such that
? Example: 5 data points and 3 clusters
n: data point index
k: cluster index
17
Q&A
? We know
? What does mean?
K-means Cost Function
prototypes
responsibilities
data
Minimizing the Cost Function
? E-step: minimize w.r.t.
? assigns each data point to nearest prototype
? M-step: minimize w.r.t
? gives
? each prototype set to the mean of points in that cluster
20
Convergence of K-means Algorithm
? Will K-Means objective oscillate?
21
Convergence of K-means Algorithm
? Will K-Means objective oscillate?.
? The answer is NO. Each iteration of K-means algorithm decrease the
objective.
? Both E step and M step decrease the objective for each data point
22
Convergence of K-means Algorithm
? Will K-Means objective oscillate?.
? The answer is NO. Each iteration of K-means algorithm decrease the
objective.
? Both E step and M step decrease the objective for each data point
? The minimum value of the objective is finite.
? The minimal value of objective is simply 0
23
Convergence of K-means Algorithm
? Will K-Means objective oscillate?.
? The answer is NO. Each iteration of K-means algorithm decrease the
objective.
? Both E step and M step decrease the objective for each data point
? The minimum value of the objective is finite.
? The minimal value of objective is simply 0
? Therefore K-means algorithm will converge with sufficiently large
number of iterations.
How to choose K?
Plot the within-cluster sum of squares (WCSS) against the number of clusters (k).
The WCSS decreases as k increases, but the rate of decrease sharply changes at a certain
point, creating an "elbow" in the graph.
Application of K-Means Algorithm to Image
Segmentation
? First, we convert all the image pixels to the HSV color
space. We then proceed to cluster the image pixels based
on their HSV color intensities. Finally, we replace each pixel
with the color of its corresponding cluster center.
Application of K-Means Algorithm to Image
Segmentation
? Nice Artistic Effects!
Limitations of K-means
? Sensitivity to Initial Centroids:
? The final results of k-means clustering are sensitive to the initial random
selection of cluster centers. This can lead to different results each time k-
means is run.
? For certain initialization, k-means clustering will perform badly.
? Q&A: How to handle the bad initialization issue?
Limitations of K-means
? Sensitivity to Initial Centroids:
? The final results of k-means clustering are sensitive to the initial random
selection of cluster centers. This can lead to different results each time k-
means is run.
? For certain initialization, k-means clustering will perform badly.
? Q&A: How to handle the bad initialization issue?
? Run k-means several times with different random initializations and choose the
clustering result with the lowest objective score (lowest within-cluster sum of squares
(WCSS))
Limitations of K-means
? Assumption of Spherical Clusters and Equal Variance of Clusters: K-
means assumes that clusters are spherical and isotropic, which means
all clusters are of the same size (variance) and density
? Difficulty with Non-convex Shapes
30
Limitations of K means
? Other limitations:
? Not clear how to choose the value of K
? Sensitivity to Outliers
? Scalability with High Dimensionality
GMM can resolve some but not all the above issues.

More Related Content

Similar to K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course (20)

machine learning - Clustering in R
machine learning - Clustering in Rmachine learning - Clustering in R
machine learning - Clustering in R
Sudhakar Chavan
?
CSA 3702 machine learning module 3
CSA 3702 machine learning module 3CSA 3702 machine learning module 3
CSA 3702 machine learning module 3
Nandhini S
?
Towards Accurate Multi-person Pose Estimation in the Wild (My summery)
Towards Accurate Multi-person Pose Estimation in the Wild (My summery)Towards Accurate Multi-person Pose Estimation in the Wild (My summery)
Towards Accurate Multi-person Pose Estimation in the Wild (My summery)
Abdulrahman Kerim
?
PR-132: SSD: Single Shot MultiBox Detector
PR-132: SSD: Single Shot MultiBox DetectorPR-132: SSD: Single Shot MultiBox Detector
PR-132: SSD: Single Shot MultiBox Detector
Jinwon Lee
?
k-Means Clustering.pptx
k-Means Clustering.pptxk-Means Clustering.pptx
k-Means Clustering.pptx
NJYOTSHNA
?
Fa18_P2.pptx
Fa18_P2.pptxFa18_P2.pptx
Fa18_P2.pptx
Md Abul Hayat
?
Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford
MapR Technologies
?
Oxford 05-oct-2012
Oxford 05-oct-2012Oxford 05-oct-2012
Oxford 05-oct-2012
Ted Dunning
?
A Unified Framework for Computer Vision Tasks: (Conditional) Generative Model...
A Unified Framework for Computer Vision Tasks: (Conditional) Generative Model...A Unified Framework for Computer Vision Tasks: (Conditional) Generative Model...
A Unified Framework for Computer Vision Tasks: (Conditional) Generative Model...
Sangwoo Mo
?
Image Compression using K-Means Clustering Method
Image Compression using K-Means Clustering MethodImage Compression using K-Means Clustering Method
Image Compression using K-Means Clustering Method
Gyanendra Awasthi
?
Selection K in K-means Clustering
Selection K in K-means ClusteringSelection K in K-means Clustering
Selection K in K-means Clustering
Junghoon Kim
?
Unsupervised learning and clustering.pdf
Unsupervised learning and clustering.pdfUnsupervised learning and clustering.pdf
Unsupervised learning and clustering.pdf
officialnovice7
?
K-Means Algorithm
K-Means AlgorithmK-Means Algorithm
K-Means Algorithm
Carlos Castillo (ChaTo)
?
Sergei Vassilvitskii, Research Scientist, Google at MLconf NYC - 4/15/16
Sergei Vassilvitskii, Research Scientist, Google at MLconf NYC - 4/15/16Sergei Vassilvitskii, Research Scientist, Google at MLconf NYC - 4/15/16
Sergei Vassilvitskii, Research Scientist, Google at MLconf NYC - 4/15/16
MLconf
?
Training machine learning k means 2017
Training machine learning k means 2017Training machine learning k means 2017
Training machine learning k means 2017
Iwan Sofana
?
Unsupervised Learning in Machine Learning
Unsupervised Learning in Machine LearningUnsupervised Learning in Machine Learning
Unsupervised Learning in Machine Learning
Pyingkodi Maran
?
W5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptx
W5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptx
W5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptx
NandiniKumari54
?
Fuzzy c means clustering protocol for wireless sensor networks
Fuzzy c means clustering protocol for wireless sensor networksFuzzy c means clustering protocol for wireless sensor networks
Fuzzy c means clustering protocol for wireless sensor networks
mourya chandra
?
Caustic Object Construction Based on Multiple Caustic Patterns
Caustic Object Construction Based on Multiple Caustic PatternsCaustic Object Construction Based on Multiple Caustic Patterns
Caustic Object Construction Based on Multiple Caustic Patterns
Budianto Tandianus
?
Neural nw k means
Neural nw k meansNeural nw k means
Neural nw k means
Eng. Dr. Dennis N. Mwighusa
?
machine learning - Clustering in R
machine learning - Clustering in Rmachine learning - Clustering in R
machine learning - Clustering in R
Sudhakar Chavan
?
CSA 3702 machine learning module 3
CSA 3702 machine learning module 3CSA 3702 machine learning module 3
CSA 3702 machine learning module 3
Nandhini S
?
Towards Accurate Multi-person Pose Estimation in the Wild (My summery)
Towards Accurate Multi-person Pose Estimation in the Wild (My summery)Towards Accurate Multi-person Pose Estimation in the Wild (My summery)
Towards Accurate Multi-person Pose Estimation in the Wild (My summery)
Abdulrahman Kerim
?
PR-132: SSD: Single Shot MultiBox Detector
PR-132: SSD: Single Shot MultiBox DetectorPR-132: SSD: Single Shot MultiBox Detector
PR-132: SSD: Single Shot MultiBox Detector
Jinwon Lee
?
k-Means Clustering.pptx
k-Means Clustering.pptxk-Means Clustering.pptx
k-Means Clustering.pptx
NJYOTSHNA
?
Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford Fast Single-pass K-means Clusterting at Oxford
Fast Single-pass K-means Clusterting at Oxford
MapR Technologies
?
A Unified Framework for Computer Vision Tasks: (Conditional) Generative Model...
A Unified Framework for Computer Vision Tasks: (Conditional) Generative Model...A Unified Framework for Computer Vision Tasks: (Conditional) Generative Model...
A Unified Framework for Computer Vision Tasks: (Conditional) Generative Model...
Sangwoo Mo
?
Image Compression using K-Means Clustering Method
Image Compression using K-Means Clustering MethodImage Compression using K-Means Clustering Method
Image Compression using K-Means Clustering Method
Gyanendra Awasthi
?
Selection K in K-means Clustering
Selection K in K-means ClusteringSelection K in K-means Clustering
Selection K in K-means Clustering
Junghoon Kim
?
Unsupervised learning and clustering.pdf
Unsupervised learning and clustering.pdfUnsupervised learning and clustering.pdf
Unsupervised learning and clustering.pdf
officialnovice7
?
Sergei Vassilvitskii, Research Scientist, Google at MLconf NYC - 4/15/16
Sergei Vassilvitskii, Research Scientist, Google at MLconf NYC - 4/15/16Sergei Vassilvitskii, Research Scientist, Google at MLconf NYC - 4/15/16
Sergei Vassilvitskii, Research Scientist, Google at MLconf NYC - 4/15/16
MLconf
?
Training machine learning k means 2017
Training machine learning k means 2017Training machine learning k means 2017
Training machine learning k means 2017
Iwan Sofana
?
Unsupervised Learning in Machine Learning
Unsupervised Learning in Machine LearningUnsupervised Learning in Machine Learning
Unsupervised Learning in Machine Learning
Pyingkodi Maran
?
W5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptx
W5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptx
W5_CLASSIFICATION.pptxW5_CLASSIFICATION.pptx
NandiniKumari54
?
Fuzzy c means clustering protocol for wireless sensor networks
Fuzzy c means clustering protocol for wireless sensor networksFuzzy c means clustering protocol for wireless sensor networks
Fuzzy c means clustering protocol for wireless sensor networks
mourya chandra
?
Caustic Object Construction Based on Multiple Caustic Patterns
Caustic Object Construction Based on Multiple Caustic PatternsCaustic Object Construction Based on Multiple Caustic Patterns
Caustic Object Construction Based on Multiple Caustic Patterns
Budianto Tandianus
?

More from ssuserfece35 (7)

Adaboost Classifier for Machine Learning Course
Adaboost Classifier for Machine Learning CourseAdaboost Classifier for Machine Learning Course
Adaboost Classifier for Machine Learning Course
ssuserfece35
?
Build_Machine_Learning_System for Machine Learning Course
Build_Machine_Learning_System for Machine Learning CourseBuild_Machine_Learning_System for Machine Learning Course
Build_Machine_Learning_System for Machine Learning Course
ssuserfece35
?
GMM Clustering Presentation ºÝºÝߣs for Machine Learning Course
GMM Clustering Presentation ºÝºÝߣs for Machine Learning CourseGMM Clustering Presentation ºÝºÝߣs for Machine Learning Course
GMM Clustering Presentation ºÝºÝߣs for Machine Learning Course
ssuserfece35
?
Introduction to Machine Learning Lectures
Introduction to Machine Learning LecturesIntroduction to Machine Learning Lectures
Introduction to Machine Learning Lectures
ssuserfece35
?
hyperparamater search netowrk technnique
hyperparamater search netowrk technniquehyperparamater search netowrk technnique
hyperparamater search netowrk technnique
ssuserfece35
?
5 ÍÆÏë¿Æ¼¼Infervision_Intro_NV_English Intro Material
5 ÍÆÏë¿Æ¼¼Infervision_Intro_NV_English Intro Material5 ÍÆÏë¿Æ¼¼Infervision_Intro_NV_English Intro Material
5 ÍÆÏë¿Æ¼¼Infervision_Intro_NV_English Intro Material
ssuserfece35
?
Transformer in Medical Imaging A brief review
Transformer in Medical Imaging A brief reviewTransformer in Medical Imaging A brief review
Transformer in Medical Imaging A brief review
ssuserfece35
?
Adaboost Classifier for Machine Learning Course
Adaboost Classifier for Machine Learning CourseAdaboost Classifier for Machine Learning Course
Adaboost Classifier for Machine Learning Course
ssuserfece35
?
Build_Machine_Learning_System for Machine Learning Course
Build_Machine_Learning_System for Machine Learning CourseBuild_Machine_Learning_System for Machine Learning Course
Build_Machine_Learning_System for Machine Learning Course
ssuserfece35
?
GMM Clustering Presentation ºÝºÝߣs for Machine Learning Course
GMM Clustering Presentation ºÝºÝߣs for Machine Learning CourseGMM Clustering Presentation ºÝºÝߣs for Machine Learning Course
GMM Clustering Presentation ºÝºÝߣs for Machine Learning Course
ssuserfece35
?
Introduction to Machine Learning Lectures
Introduction to Machine Learning LecturesIntroduction to Machine Learning Lectures
Introduction to Machine Learning Lectures
ssuserfece35
?
hyperparamater search netowrk technnique
hyperparamater search netowrk technniquehyperparamater search netowrk technnique
hyperparamater search netowrk technnique
ssuserfece35
?
5 ÍÆÏë¿Æ¼¼Infervision_Intro_NV_English Intro Material
5 ÍÆÏë¿Æ¼¼Infervision_Intro_NV_English Intro Material5 ÍÆÏë¿Æ¼¼Infervision_Intro_NV_English Intro Material
5 ÍÆÏë¿Æ¼¼Infervision_Intro_NV_English Intro Material
ssuserfece35
?
Transformer in Medical Imaging A brief review
Transformer in Medical Imaging A brief reviewTransformer in Medical Imaging A brief review
Transformer in Medical Imaging A brief review
ssuserfece35
?

Recently uploaded (20)

Chapter 6. Business and Corporate Strategy Formulation.pdf
Chapter 6. Business and Corporate Strategy Formulation.pdfChapter 6. Business and Corporate Strategy Formulation.pdf
Chapter 6. Business and Corporate Strategy Formulation.pdf
Rommel Regala
?
U.S. Department of Education certification
U.S. Department of Education certificationU.S. Department of Education certification
U.S. Department of Education certification
Mebane Rash
?
Berry_Kanisha_BAS_PB1_202503 (2) (2).pdf
Berry_Kanisha_BAS_PB1_202503 (2) (2).pdfBerry_Kanisha_BAS_PB1_202503 (2) (2).pdf
Berry_Kanisha_BAS_PB1_202503 (2) (2).pdf
KanishaBerry
?
Knownsense 2025 Finals-U-25 General Quiz.pdf
Knownsense 2025 Finals-U-25 General Quiz.pdfKnownsense 2025 Finals-U-25 General Quiz.pdf
Knownsense 2025 Finals-U-25 General Quiz.pdf
Pragya - UEM Kolkata Quiz Club
?
Introduction to Systematic Reviews - Prof Ejaz Khan
Introduction to Systematic Reviews - Prof Ejaz KhanIntroduction to Systematic Reviews - Prof Ejaz Khan
Introduction to Systematic Reviews - Prof Ejaz Khan
Systematic Reviews Network (SRN)
?
Role of Teacher in the era of Generative AI
Role of Teacher in the era of Generative AIRole of Teacher in the era of Generative AI
Role of Teacher in the era of Generative AI
Prof. Neeta Awasthy
?
Digital Electronics: Fundamentals of Combinational Circuits
Digital Electronics: Fundamentals of Combinational CircuitsDigital Electronics: Fundamentals of Combinational Circuits
Digital Electronics: Fundamentals of Combinational Circuits
GS Virdi
?
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptxCLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
?
How to Install Odoo 18 with Pycharm - Odoo 18 ºÝºÝߣs
How to Install Odoo 18 with Pycharm - Odoo 18 ºÝºÝߣsHow to Install Odoo 18 with Pycharm - Odoo 18 ºÝºÝߣs
How to Install Odoo 18 with Pycharm - Odoo 18 ºÝºÝߣs
Celine George
?
MIPLM subject matter expert Dr Robert Klinski
MIPLM subject matter expert Dr Robert KlinskiMIPLM subject matter expert Dr Robert Klinski
MIPLM subject matter expert Dr Robert Klinski
MIPLM
?
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VIAnti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Samruddhi Khonde
?
MIPLM subject matter expert Nicos Raftis
MIPLM subject matter expert Nicos RaftisMIPLM subject matter expert Nicos Raftis
MIPLM subject matter expert Nicos Raftis
MIPLM
?
NURSING PROCESS AND ITS STEPS .pptx
NURSING PROCESS AND ITS STEPS                 .pptxNURSING PROCESS AND ITS STEPS                 .pptx
NURSING PROCESS AND ITS STEPS .pptx
PoojaSen20
?
General Quiz at Maharaja Agrasen College | Amlan Sarkar | Prelims with Answer...
General Quiz at Maharaja Agrasen College | Amlan Sarkar | Prelims with Answer...General Quiz at Maharaja Agrasen College | Amlan Sarkar | Prelims with Answer...
General Quiz at Maharaja Agrasen College | Amlan Sarkar | Prelims with Answer...
Amlan Sarkar
?
Viceroys of India & Their Tenure ¨C Key Events During British Rule
Viceroys of India & Their Tenure ¨C Key Events During British RuleViceroys of India & Their Tenure ¨C Key Events During British Rule
Viceroys of India & Their Tenure ¨C Key Events During British Rule
DeeptiKumari61
?
MIPLM subject matter expert Daniel Holzner
MIPLM subject matter expert Daniel HolznerMIPLM subject matter expert Daniel Holzner
MIPLM subject matter expert Daniel Holzner
MIPLM
?
General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...
General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...
General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...
Amlan Sarkar
?
Different perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdfDifferent perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdf
Aivar Ruukel
?
? Marketing is Everything in the Beauty Business! ??? Talent gets you in the ...
? Marketing is Everything in the Beauty Business! ??? Talent gets you in the ...? Marketing is Everything in the Beauty Business! ??? Talent gets you in the ...
? Marketing is Everything in the Beauty Business! ??? Talent gets you in the ...
coreylewis960
?
Chapter 6. Business and Corporate Strategy Formulation.pdf
Chapter 6. Business and Corporate Strategy Formulation.pdfChapter 6. Business and Corporate Strategy Formulation.pdf
Chapter 6. Business and Corporate Strategy Formulation.pdf
Rommel Regala
?
U.S. Department of Education certification
U.S. Department of Education certificationU.S. Department of Education certification
U.S. Department of Education certification
Mebane Rash
?
Berry_Kanisha_BAS_PB1_202503 (2) (2).pdf
Berry_Kanisha_BAS_PB1_202503 (2) (2).pdfBerry_Kanisha_BAS_PB1_202503 (2) (2).pdf
Berry_Kanisha_BAS_PB1_202503 (2) (2).pdf
KanishaBerry
?
Role of Teacher in the era of Generative AI
Role of Teacher in the era of Generative AIRole of Teacher in the era of Generative AI
Role of Teacher in the era of Generative AI
Prof. Neeta Awasthy
?
Digital Electronics: Fundamentals of Combinational Circuits
Digital Electronics: Fundamentals of Combinational CircuitsDigital Electronics: Fundamentals of Combinational Circuits
Digital Electronics: Fundamentals of Combinational Circuits
GS Virdi
?
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptxCLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
CLEFT LIP AND PALATE: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
?
How to Install Odoo 18 with Pycharm - Odoo 18 ºÝºÝߣs
How to Install Odoo 18 with Pycharm - Odoo 18 ºÝºÝߣsHow to Install Odoo 18 with Pycharm - Odoo 18 ºÝºÝߣs
How to Install Odoo 18 with Pycharm - Odoo 18 ºÝºÝߣs
Celine George
?
MIPLM subject matter expert Dr Robert Klinski
MIPLM subject matter expert Dr Robert KlinskiMIPLM subject matter expert Dr Robert Klinski
MIPLM subject matter expert Dr Robert Klinski
MIPLM
?
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VIAnti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Anti-Viral Agents.pptx Medicinal Chemistry III, B Pharm SEM VI
Samruddhi Khonde
?
MIPLM subject matter expert Nicos Raftis
MIPLM subject matter expert Nicos RaftisMIPLM subject matter expert Nicos Raftis
MIPLM subject matter expert Nicos Raftis
MIPLM
?
NURSING PROCESS AND ITS STEPS .pptx
NURSING PROCESS AND ITS STEPS                 .pptxNURSING PROCESS AND ITS STEPS                 .pptx
NURSING PROCESS AND ITS STEPS .pptx
PoojaSen20
?
General Quiz at Maharaja Agrasen College | Amlan Sarkar | Prelims with Answer...
General Quiz at Maharaja Agrasen College | Amlan Sarkar | Prelims with Answer...General Quiz at Maharaja Agrasen College | Amlan Sarkar | Prelims with Answer...
General Quiz at Maharaja Agrasen College | Amlan Sarkar | Prelims with Answer...
Amlan Sarkar
?
Viceroys of India & Their Tenure ¨C Key Events During British Rule
Viceroys of India & Their Tenure ¨C Key Events During British RuleViceroys of India & Their Tenure ¨C Key Events During British Rule
Viceroys of India & Their Tenure ¨C Key Events During British Rule
DeeptiKumari61
?
MIPLM subject matter expert Daniel Holzner
MIPLM subject matter expert Daniel HolznerMIPLM subject matter expert Daniel Holzner
MIPLM subject matter expert Daniel Holzner
MIPLM
?
General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...
General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...
General Quiz at ChakraView 2025 | Amlan Sarkar | Ashoka Univeristy | Prelims ...
Amlan Sarkar
?
Different perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdfDifferent perspectives on dugout canoe heritage of Soomaa.pdf
Different perspectives on dugout canoe heritage of Soomaa.pdf
Aivar Ruukel
?
? Marketing is Everything in the Beauty Business! ??? Talent gets you in the ...
? Marketing is Everything in the Beauty Business! ??? Talent gets you in the ...? Marketing is Everything in the Beauty Business! ??? Talent gets you in the ...
? Marketing is Everything in the Beauty Business! ??? Talent gets you in the ...
coreylewis960
?

K-Means Clustering Presentation ºÝºÝߣs for Machine Learning Course

  • 1. 1 DTS304TC: Machine Learning Lecture 7: K-Means Clustering Dr Kang Dang D-5032, Taicang Campus Kang.Dang@xjtlu.edu.cn Tel: 88973341
  • 2. 2 Acknowledges This set of lecture notes has been adapted from materials originally provided by Christopher M. Bishop¡¯s and Xin Chen.
  • 3. Overview. ? K-means clustering ? Application of K-means clustering in image segmentation
  • 4. 4 Q&A ? What is clustering? ? What is one application of the clustering?
  • 5. Old Faithful Data Set Duration of eruption (minutes) Time between eruptions (minutes)
  • 6. K-means Algorithm ? Goal: represent a data set in terms of K clusters each of which is summarized by a prototype ? Initialize prototypes, then iterate between two phases: ? E-step (Cluster Assignment) : assign each data point to nearest prototype ? M-step(Prototype update): update prototypes to be the cluster means ? Simplest version is based on Euclidean distance
  • 16. Responsibilities ? Responsibilities assign data points to clusters such that ? Example: 5 data points and 3 clusters n: data point index k: cluster index
  • 17. 17 Q&A ? We know ? What does mean?
  • 19. Minimizing the Cost Function ? E-step: minimize w.r.t. ? assigns each data point to nearest prototype ? M-step: minimize w.r.t ? gives ? each prototype set to the mean of points in that cluster
  • 20. 20 Convergence of K-means Algorithm ? Will K-Means objective oscillate?
  • 21. 21 Convergence of K-means Algorithm ? Will K-Means objective oscillate?. ? The answer is NO. Each iteration of K-means algorithm decrease the objective. ? Both E step and M step decrease the objective for each data point
  • 22. 22 Convergence of K-means Algorithm ? Will K-Means objective oscillate?. ? The answer is NO. Each iteration of K-means algorithm decrease the objective. ? Both E step and M step decrease the objective for each data point ? The minimum value of the objective is finite. ? The minimal value of objective is simply 0
  • 23. 23 Convergence of K-means Algorithm ? Will K-Means objective oscillate?. ? The answer is NO. Each iteration of K-means algorithm decrease the objective. ? Both E step and M step decrease the objective for each data point ? The minimum value of the objective is finite. ? The minimal value of objective is simply 0 ? Therefore K-means algorithm will converge with sufficiently large number of iterations.
  • 24. How to choose K? Plot the within-cluster sum of squares (WCSS) against the number of clusters (k). The WCSS decreases as k increases, but the rate of decrease sharply changes at a certain point, creating an "elbow" in the graph.
  • 25. Application of K-Means Algorithm to Image Segmentation ? First, we convert all the image pixels to the HSV color space. We then proceed to cluster the image pixels based on their HSV color intensities. Finally, we replace each pixel with the color of its corresponding cluster center.
  • 26. Application of K-Means Algorithm to Image Segmentation ? Nice Artistic Effects!
  • 27. Limitations of K-means ? Sensitivity to Initial Centroids: ? The final results of k-means clustering are sensitive to the initial random selection of cluster centers. This can lead to different results each time k- means is run. ? For certain initialization, k-means clustering will perform badly. ? Q&A: How to handle the bad initialization issue?
  • 28. Limitations of K-means ? Sensitivity to Initial Centroids: ? The final results of k-means clustering are sensitive to the initial random selection of cluster centers. This can lead to different results each time k- means is run. ? For certain initialization, k-means clustering will perform badly. ? Q&A: How to handle the bad initialization issue? ? Run k-means several times with different random initializations and choose the clustering result with the lowest objective score (lowest within-cluster sum of squares (WCSS))
  • 29. Limitations of K-means ? Assumption of Spherical Clusters and Equal Variance of Clusters: K- means assumes that clusters are spherical and isotropic, which means all clusters are of the same size (variance) and density ? Difficulty with Non-convex Shapes
  • 30. 30 Limitations of K means ? Other limitations: ? Not clear how to choose the value of K ? Sensitivity to Outliers ? Scalability with High Dimensionality GMM can resolve some but not all the above issues.

Editor's Notes

  • #6: Our goal is to organize a big bunch of data into K groups, and for each group, we'll pick one item to be its example or "prototype." First, we choose some starting prototypes. Then we do two steps over and over: First, the E-step, where we put each piece of data into the group with the closest prototype. Second, the M-step, where we find the average of all the items in each group and make that the new prototype. We keep doing this until the groups make sense. We measure closeness by the simplest method, which is like measuring a straight line distance between points, called Euclidean distance.
  • #24: Plot the within-cluster sum of squares (WCSS) against the number of clusters (k). The WCSS decreases as k increases, but the rate of decrease sharply changes at a certain point, creating an "elbow" in the graph. The elbow generally represents a point where adding more clusters doesn't explain much more variance in the data. Choose k at this point.