Find Cluster representative

dadadude used Ask the Experts™
I have a cluster C = [v1,v2,...,Vn] i am trying to find a Vector vi that can be the representative of that cluster, and i don't think that what i am doing is right, that's the pseudo code:
in the code:
I do the following:
For all vectors in C (i)
    sum = 0
     For all vectors in C (j)
            sum+ = d(vi,vj);
   // add distance and vector to a list

find the vector with the minimum distance. Is that wrong?
thank you
List<Values> distance = new List<Values>();
        for (int i = 0; i < tab.Count; i++)
            double sum = 0.0;  
            for (int j = 0; j < tab.Count; j++)
               //tab[i] and tab[j] are 2 vectors
                sum += ManhattanDistance(tab[i],tab[j]);
            distance.Add(new Values(tab[i],sum));
        }//end for
        return distance[0].Vector;

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2014
Top Expert 2015
if you think that the median value is a good representative of values on linear scale,
and that ManhattanDistance is a good way to combine the distance measures on different components,
then  your method seems reasonable.
Awarded 2010
Top Expert 2013
Are you sure you want to use Manhattan Distance? From what I've seen, it's used more often than it should be.

Manhattan distance only makes sense if a 'zigzag' movement pattern makes sense (i.e. straight line distance can not be used). If there is no reason against using straight lines when discussing distance, then you should probably be using Euclidean distance.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial