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

    https://github.com/apache/spark/pull/7412#discussion_r34648954
  
    --- Diff: mllib/src/main/scala/org/apache/spark/mllib/fpm/PrefixSpan.scala 
---
    @@ -86,16 +88,69 @@ class PrefixSpan private (
           getFreqItemAndCounts(minCount, sequences).collect()
         val prefixAndProjectedDatabase = getPrefixAndProjectedDatabase(
           lengthOnePatternsAndCounts.map(_._1), sequences)
    -    val groupedProjectedDatabase = prefixAndProjectedDatabase
    -      .map(x => (x._1.toSeq, x._2))
    -      .groupByKey()
    -      .map(x => (x._1.toArray, x._2.toArray))
    -    val nextPatterns = getPatternsInLocal(minCount, 
groupedProjectedDatabase)
    -    val lengthOnePatternsAndCountsRdd =
    -      sequences.sparkContext.parallelize(
    -        lengthOnePatternsAndCounts.map(x => (Array(x._1), x._2)))
    -    val allPatterns = lengthOnePatternsAndCountsRdd ++ nextPatterns
    -    allPatterns
    +
    +    var patternsCount = lengthOnePatternsAndCounts.length
    +    var allPatternAndCounts = sequences.sparkContext.parallelize(
    +      lengthOnePatternsAndCounts.map(x => (Array(x._1), x._2)))
    +    var currentProjectedDatabase = prefixAndProjectedDatabase
    +    while (patternsCount <= minPatternsBeforeShuffle &&
    +      currentProjectedDatabase.count() != 0) {
    +      val (nextPatternAndCounts, nextProjectedDatabase) =
    +        getPatternCountsAndProjectedDatabase(minCount, 
currentProjectedDatabase)
    +      patternsCount = nextPatternAndCounts.count().toInt
    +      currentProjectedDatabase = nextProjectedDatabase
    +      allPatternAndCounts = allPatternAndCounts ++ nextPatternAndCounts
    +    }
    +    if (patternsCount > 0) {
    +      val groupedProjectedDatabase = currentProjectedDatabase
    --- End diff --
    
    This is the `projectedDatabases`; everything before was (prefix,suffix) 
pairs


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to