-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-9883][MLlib] Distance to each kmean cluster given a point #8849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it compile?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed not. The diff I received must have been a work in progress. This is now fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it was... Sorry about that.
2015-09-21 14:01 GMT-07:00 Bertrand Dechoux [email protected]:
In
mllib/src/main/scala/org/apache/spark/mllib/clustering/KMeansModel.scala
#8849 (comment):@@ -77,6 +77,22 @@ class KMeansModel @SInCE("1.1.0") (@SInCE("1.0.0") val clusterCenters: Array[Vec
def predict(points: JavaRDD[Vector]): JavaRDD[java.lang.Integer] =
predict(points.rdd).toJavaRDD().asInstanceOf[JavaRDD[java.lang.Integer]]
- /** */
- def distanceToCenters(point: Vector): (Int, Double) = {
Indeed not. The diff I received must have been a work in progress. This is
now fixed.—
Reply to this email directly or view it on GitHub
https://github.com/apache/spark/pull/8849/files#r40025294.
Timothée Rebours
13, rue Georges Bizet
78380 BOUGIVAL
|
ok to test |
Somehow I am glad that it does not only happen to my projects. The patch is still basic and need a few changes
|
|
Test build #42773 has finished for PR 8849 at commit
|
|
|
Test build #42775 has finished for PR 8849 at commit
|
|
I think I still need to change the method signature. Predict on a RDD is the following def predict(points: RDD[Vector]): RDD[Int]Distances on a RDD is the following def distanceToCenters(points: RDD[Vector]): RDD[(Vector, Iterable[(VectorWithNorm, Double)])]I am more confortable with having the input point in the output but predict does no work like that. The second aspect is that I may want to output cluster indices instead of their locations. I would be glad to have your point of view @mengxr. |
…roviding distances to a given point
… a given point to the clusters
|
|
Test build #42856 has finished for PR 8849 at commit
|
|
Test build #42854 has finished for PR 8849 at commit
|
|
def distanceToCenters(points: RDD[Vector]): RDD[(Vector, Iterable[(VectorWithNorm, Double)])] |
|
Jenkins, test this please |
|
Test build #44797 has finished for PR 8849 at commit
|
|
@BertrandDechoux thank you for the update. Sounds interesting, but I don't think we should calculate distances between a point and all centers. Personally, I think we should calculate the distance between a point and the closest center. And I'm wondering if the method should return the pair of cluster index and distance or only distance. @mengxr @jkbradley what do you think? |
|
In a perfect world, each point belongs to a specific cluster and the number of clusters is easy to find. In reality, it is less so. Knowing the distance is a way to appreciate the closeness of a point with regard to a cluster. K-means can be thought as a special mixture model. When using a mixture model, the impact of each 'cluster' with regard to a specific point is an important information. I think the same holds true for K-means. But, in the end, it does depend in which context and how you are using K-means indeed. |
|
Can one of the admins verify this patch? |
|
I think this should just be closed. I don't think there's enough value in adding this API now. |
Closes apache#20932 Closes apache#17843 Closes apache#13477 Closes apache#14291 Closes apache#20919 Closes apache#17907 Closes apache#18766 Closes apache#20809 Closes apache#8849 Closes apache#21076 Closes apache#21507 Closes apache#21336 Closes apache#21681 Closes apache#21691 Author: Sean Owen <[email protected]> Closes apache#21708 from srowen/CloseStalePRs.
First step done by @tex0l ;)