modelKMeans_1d
Model that verifies the k-means clustering function for 1d data
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
This example tests the k-means clustering algorithm on 1d data.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n_clusters | 3 | Number of clusters to be generated |
| Real[:,:] | data | [1; 2; 2; 3; 4] | 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, 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.