Avatar of dadadude
dadadude
 asked on

Find Cluster representative

Hello,
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
   list.add(d)

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
        distance.Sort(Values.CompareCarSpecs);
        return distance[0].Vector;

Open in new window

AlgorithmsProgramming Languages-Other

Avatar of undefined
Last Comment
TommySzalapski

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
ozo

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
SOLUTION
TommySzalapski

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes