Centroid of clusters found by linfa_clustering::Dbscan

I'm trying to find the centroids of the clusters identified by linfa_clustering::Dbscan, and I've been banging my head against various brick walls for far too long now.

I'm not familiar with ndarray which doesn't help, but at this stage I'm pretty sure that I must be missing something obvious.

Is there some not too painful way of calculating these centroids?

[A little background info:

Given an input array of observations

let observations = array![[1.0, 1.0, 3.0],
                          [1.1, 1.1, 3.0],
                          [0.9, 0.9, 3.0],
                          [0.9, 1.1, 3.0],
                          [1.1, 0.9, 3.0],
                          [1.0, 0.9, 3.0],
                          [0.9, 1.0, 3.0],
                          [1.0, 1.1, 3.0],
                          [1.1, 1.0, 3.0],

                          [2.0, 2.0, 3.0],
                          [2.1, 2.1, 3.0],
                          [1.9, 1.9, 3.0],
                          [1.9, 2.1, 3.0],
                          [2.1, 1.9, 3.0],
                          [2.0, 1.9, 3.0],
                          [1.9, 2.0, 3.0],
                          [2.0, 2.1, 3.0],
                          [2.1, 2.0, 3.0],
                          
                          [9.9, 9.9, 9.9]];

the algorithm produces a 1-D array of labels:

Some(0),
Some(0),
...
Some(1),
Some(1),
...
None

Indicating whether each observation in the input array belongs to Some cluster, or is noise that does not belong to any cluster (None).
]

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.