You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by srowen <gi...@git.apache.org> on 2016/07/27 10:32:27 UTC

[GitHub] spark pull request #14333: [SPARK-16696][ML][MLLib] destroy KMeans bcNewCent...

Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14333#discussion_r72416823
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/clustering/BisectingKMeans.scala ---
    @@ -194,8 +196,9 @@ class BisectingKMeans private (
               newClusters = summarize(d, newAssignments)
               newClusterCenters = newClusters.mapValues(_.center).map(identity)
             }
    -        // TODO: Unpersist old indices.
    -        val indices = updateAssignments(assignments, divisibleIndices, newClusterCenters).keys
    +        if (preIndices != null) preIndices.unpersist()
    +        preIndices = indices
    +        indices = updateAssignments(assignments, divisibleIndices, newClusterCenters).keys
    --- End diff --
    
    You are probably ahead of me on this, but let me check something. To compute `assignments` in the next line, the current `indices` is needed, and that in turn needs the current value of `assignments`, which needs the previous copy of `indices` (`preIndices`). But that was unpersisted just above. Should `preIndices` be unpersisted later, after `indices` is materialized?
    
    But ... is there even an action here? if this just creating a large lineage then the persisting isn't helping much.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org