Hi,
This tool is amazing! Quick question for you. I am using this to cluster groups of students based on their performance. Your tool produces the clusters exactly as I would hope. However, it doesn't seem to output which data indexes are in each cluster, just the data itself. What I'd like is for each cluster output to include an array of the indexes contained, so that I can easily say "Cluster 1 includes students 1, 4, and 8", Cluster 2 includes students 2, 3, and 6", etc.
Is that possible? Or do I have to do a lookup after the fact to reconnect the original data index with the cluster outputs based on the points array?
Thanks,
John
Hello,
In a similar case, I add property id to a point.
point1 = [1, 0], point1.id = id
points = [ point1, point2 ..., pointN]
Array in js is object also. You can add properties to it.
It says that this is not the best decision, but sometimes it works.
After creating clusters this property for points is excited.
I using this library for creating k-means cluster for choropleth map.
With best regards,
ZhnZhn
Thanks for the feedback! As of now, you would have to look up the index from the original data. Something like this:
``` javascript
clusters.forEach(function(cluster, index) {
console.log('cluster ' + index + ' includes students');
cluster.points.forEach(function(point) {
console.log(originalDataArray.indexOf(point));
});
});
```