name: inverse layout: true class: center, middle, inverse --- # KMeans Algorithm ### By ChengMingbo ### 2017-8-18 .footnote[powered by
remark.js
] ??? I am a note, will be only shown when under presentation mode --- layout: false # Outline * Classification and Clustering * Applications * KMeans * Other Cluster Algorithm --- template: inverse # Classification and Clustering --- layout: false ## classify
--- ## clustering
--- template: inverse # Applications --- layout: false ## Applications .left-column[ - Google News ] .right-column[
] --- ## Applications .left-column[ - Google News - Marketing ] .right-column[
] --- ## Applications .left-column[ - Google News - Marketing - Vibration Detection ] .right-column[
] --- template: inverse # KMeans --- layout: false ## KMeans Cartoon .center[![](http://cmb.oss-cn-qingdao.aliyuncs.com/2017-08-18-kmeans.gif)] --- layout: false ## Algorithm .pseudocode[ 1. Initialize cluster centroids $\mu_1, \mu_2, \cdots, \mu_k \in R^n$ randomly. 2. Repeat until convergence{ For every i, set $$c^i := \arg\min_j ||x^i-\mu_j ||^2$$ For every j, set $$\mu_j := \frac{\sum_i 1 (c^i = j) x^i}{\sum_i 1 (c^i = j)}$$ } ] --- layout: false ## Algorithm ```octave centroid1 = X(floor(rand*200),:) centroid2 = X(floor(rand*200),:) while(1) for i=1:length(X) d1 = norm(X(i,:)-centroid1); %Euclidean distance d2 = norm(X(i,:)-centroid2); if d1 < d2 class1 = [class1; X(i,:)]; else class2 = [class2; X(i,:)]; end end m1 = mean(class1); m2 = mean(class2); if norm(m1-centroid1) <0.01 && norm(m2-centroid2) <0.01 break end centroid1 = m1; centroid2 = m2; end ``` ??? > --- template: inverse # Other Cluster Algorithm --- layout: false ## Clustering Alogrithm - Guassian Mixture Model - Affinity Propagation - DBSCAN - Latent Dirichlet Allocation --- layout: false - Guassian Mixture Model
--- layout: false - Guassian Mixture Model
--- layout: false - DBSCAN
--- layout: false - Latent Dirichlet Allocation
--- layout: false # Summary * Classification and Clustering * Applications * KMeans * Other Cluster Algorithm --- template: inverse # Thanks! # Q&A --- class: middle, center layout: false # Snacks ## Remark.js HowTo