modelKMeans_2d
Model that verifies the k-means clustering function for 2d data
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
This example tests the k-means clustering algorithm on 2d data.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n_clusters | 3 | Number of clusters to be generated |
| Real[:,:] | data | [1, 1; 1, 2; 2, 1; 2, 1.2; 3, 0; 4, 0] | Test data to be clustered |
| Integer | nDat | size(data, 1) | Number of samples |
| Integer | nDim | size(data, 2) | Number of features |
| Real | centroids | Centroids of the clusters | |
| Integer | labels | Cluster label associated with each data point | |
| Integer | cluster_size | Size of the clusters | |
| Integer[nDat] | labelsExp | {3, 3, 2, 2, 1, 1} | Expected cluster labels |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | cmp | Comparison result |
Revisions
-
June 9, 2022 by Massimo Cimmino
First implementation.