Skip to content
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