# forum.alglib.net

ALGLIB forum
 It is currently Fri Oct 18, 2019 1:04 am

 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.

 Page 1 of 1 [ 1 post ]
 Print view Previous topic | Next topic
Author Message
 Post subject: K-means clustering: finding out number of clustered elementsPosted: Sun Feb 22, 2015 7:34 pm

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

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 1 post ]

 All times are UTC

#### Who is online

Users browsing this forum: No registered users and 1 guest

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

Search for: