forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 7:39 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: K-means clustering: finding out number of clustered elements
PostPosted: Sun Feb 22, 2015 7:34 pm 
Offline

Joined: Sun Feb 22, 2015 7:22 pm
Posts: 1
I'm trying to create a "heat map" from a large dataset of coordinates, where clustering fits just fine. The k-means++ clustering example works OK, but I need not only mean coordinates based on K (stored in kmeansreport.c array), but also total number of original elements for each resulting coordinate:

Code:
Dim xy(4, 1) As Double
xy(0, 0) = 1 : xy(0, 1) = 1
xy(1, 0) = 1 : xy(1, 1) = 2
xy(2, 0) = 4 : xy(2, 1) = 1
xy(3, 0) = 2 : xy(3, 1) = 3
xy(4, 0) = 4 : xy(4, 1) = 1.5

Dim s As alglib.clusterizerstate = Nothing
Dim rep As alglib.kmeansreport = Nothing
alglib.clusterizercreate(s)
alglib.clusterizersetpoints(s, xy, 2)
alglib.clusterizersetkmeanslimits(s, 5, 0)
alglib.clusterizerrunkmeans(s, 2, rep)

Now it's possible to inspect rep.c and find out resulting coordinate pairs:

Code:
System.Console.WriteLine("X=" + rep.c(0, 0).ToString + ", Y=" + rep.c(0, 1).ToString)
System.Console.WriteLine("X=" + rep.c(1, 0).ToString + ", Y=" + rep.c(1, 1).ToString)

But, how do I compute total number of original xy elements "behind" each rep.c coordinate? When I create a heat map I need x,y and "weight" value - how do I find one?

Regards,
Maksim Sestic


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 40 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group