samedi 1 avril 2017

How to calculate the distance between two centroids?

I am classifying data. The data is of high dimensions and seperated in different classes. For each class I have calculated the centroid, which is simply a vector of the mean of each sample. For a better explanation see the simplified example below:

class1:
           dimension1   dimension2  dimenson3      mean 
sample 1     2                4          6           4
sample 2     8                5          5           3
sample 3     7                9          5           7

centroid= [4 3 7]

now i want to add a new sample (mean 2) to this centroid and calculate the distance of the old centroid to the new centroid

old centroid = [4 3 7]

new centroid = [4 3 7 2]

how can I achieve this (in Matlab)?

Aucun commentaire:

Enregistrer un commentaire