kmeans algorithm

Hi,

I am trying to implement kmeans algorithm in java for my data.

I have my data stored in ms access format and my application use sql to retrieve selected. I was testing to put sample data into vector.

e.g. {fund A, 0.022,0.45}, {fundB, 0.432, 0.888} etc.

As I learn the theory concept of kmeans algorithm to find the minimum distance between points and then to form clusters among data.

the concept is as follow.

input p= P{p1....pk} points;

n=no. of cluster for which i set as 2 for testing.

output c={c1....cn} cluster centriod

m:p-{1...n}cluster memebership

proceed kmeans

set c to intial value (which can select p1 as starting point)

for each pi belong to P

m(pi)=arg min distance(pi,cj)

while m has changed

for each i belongs to {1...n}

recompute ci as the centriodof {plm(p)=i}

for each pi belong to P

m(pi)=arg min distance (pi,cj)

since if i use the vector i have at the moment, i would not be able to separate the data e.g. {fund A, 0.022,0.45}, {fundB, 0.432, 0.888} to compare between 0.022 and 0.432 since all data in same index.? does it mean that I have to spearate it into different vector like

vector a={0.022},{0.432}

vector b={0.45},{0.888}

inorder to compare the distance?

Can someone give me a starting point for the algorithm since i am very new to java and algorithm,

as i already set my no. of cluster to 2

and I have the selected data. I assume the first centriod point as the first point p1 e.g. 0.022. but do I compare with the next availble one in the index (0.432)? or and I am quite confused with the min distance how I determine the min distance among all data variable and put it as same member?

I very much appreciate your help.

thank you.

z

[1858 byte] By [zzenitha] at [2007-9-28 10:55:00]
# 1
Have you found a solution to this problem yet? As I am currently in a similar situation to yourself.
RashidAa at 2007-7-12 1:07:15 > top of Java-index,Other Topics,Algorithms...
# 2
Go here: http://www.cse.iitb.ac.in/~sharat/past/cs622/
benc3a at 2007-7-12 1:07:15 > top of Java-index,Other Topics,Algorithms...
# 3

> Go here:

> http://www.cse.iitb.ac.in/~sharat/past/cs622/

Hi benc3. I have tried the link you supplied however it returns a 502 Proxy Error i.e

Proxy Error

The proxy server received an invalid response from an upstream server.

The proxy server could not handle the request GET /~sharat/past/cs622/.

Reason: Could not connect to remote machine: Network is unreachable

Are you sure that this was the correct URL ?

RashidAa at 2007-7-12 1:07:15 > top of Java-index,Other Topics,Algorithms...
# 4
They moved it here: http://www.cse.iitb.ac.in/~sharat/past/cs622/cs622.html
benc3a at 2007-7-12 1:07:15 > top of Java-index,Other Topics,Algorithms...
# 5
They moved it here: http://www.cse.iitb.ac.in/~sharat/past/cs622/cs622.html
benc3a at 2007-7-12 1:07:15 > top of Java-index,Other Topics,Algorithms...