zhengruifeng commented on a change in pull request #27035:
[SPARK-30351][ML][PySpark] BisectingKMeans support instance weighting
URL: https://github.com/apache/spark/pull/27035#discussion_r361838152
##########
File path:
mllib/src/main/scala/org/apache/spark/mllib/clustering/BisectingKMeans.scala
##########
@@ -156,20 +157,34 @@ class BisectingKMeans private (
private[spark] def run(
input: RDD[Vector],
instr: Option[Instrumentation]): BisectingKMeansModel = {
+ val instances: RDD[(Vector, Double)] = input.map {
+ case (point) => (point, 1.0)
+ }
+ runWithWeight(instances, None)
+ }
+
+ private[spark] def runWithWeight(
+ input: RDD[(Vector, Double)],
+ instr: Option[Instrumentation]): BisectingKMeansModel = {
if (input.getStorageLevel == StorageLevel.NONE) {
logWarning(s"The input RDD ${input.id} is not directly cached, which may
hurt performance if"
+ " its parent RDDs are also not cached.")
}
- val d = input.map(_.size).first()
+ val d = input.map( i => i._1.size).first()
Review comment:
Or just keep existing line?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]