k-means Clustering
Mit dem K-means Clustering Algorithmus lassen sich für einen Datensatz mit einer angegbenen Zahl der Cluster (k), alle Punkte aus diesem Datensatz einem der k Cluster zuweisen. Bei einigen Daten-Verteilungen funktioniert der k-Means Algorithmus leider nicht besonders gut. Eine Alternative ist daher das Gaussian Mixture Expectation Maximization Modell.
- The k-means Clustering algorithm only works with continous data, we thus need the k-modes algorithm to work with Categorical Data where you take the value that occurs most frequently in the data as centroid.
- It can only detect convex shapes
- It is sensitive to Outliers → one could thus use PAM which is insensitive to Outliers
Algorithmus
- Partition data into random / non-empty sets
- Compute centroids of the clusters
- For each Data Object
- Calculate distance to centroid
- Pick the one with the smallest distance
- Assign object to that centroids cluster
- If changes were made, repeat.
Laufzeit: where is number of data points is number of clusters and is number of iterations. The number of iterations is often really small. Thus more or less linear. Better than PAM.
- Cluster zufällig zuordnen
- Wiederholen bis sich nichts mehr ändert
- Für jeden Datenpunkt
- Rechne Distanz zu jedem Cluster aus und wähle das Minimum aus
- Weise den Datenpunkt diesem Cluster zu
- Für jeden Cluster
- Berechne das Responsibility Set
- Berechne den Durschnitt des Clusters
- Für jeden Datenpunkt