I think I'm going to implement some k means clustering into Kotlin Statistics, and idiomatically put the results into a Multimap or some other container. Then you can perform different operations on each cluster just like all the other operators. http://commons.apache.org/proper/commons-math/userguide/ml.html