Skip to content

[SPARK-14284][ML] KMeansSummary deprecating size; adding clusterSizes #12084

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

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ class KMeansSummary private[clustering] (
* Size of each cluster.
*/
@Since("2.0.0")
lazy val size: Array[Int] = cluster.rdd.map {
lazy val clusterSizes: Array[Int] = cluster.rdd.map {
case Row(clusterIdx: Int) => (clusterIdx, 1)
}.reduceByKey(_ + _).collect().sortBy(_._1).map(_._2)

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private[r] class KMeansWrapper private (

lazy val k: Int = kMeansModel.getK

lazy val size: Array[Int] = kMeansModel.summary.size
lazy val size: Array[Int] = kMeansModel.summary.clusterSizes

lazy val cluster: DataFrame = kMeansModel.summary.cluster

Expand Down