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

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;
```

ASKER CERTIFIED SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.

SOLUTION

membership

This solution is only available to members.

To access this solution, you must be a member of Experts Exchange.