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

    https://github.com/apache/spark/pull/7818#discussion_r36026148
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/fpm/PrefixSpanSuite.scala ---
    @@ -50,64 +50,138 @@ class PrefixSpanSuite extends SparkFunSuite with 
MLlibTestSparkContext {
         val result1 = prefixspan.run(rdd)
         val expectedValue1 = Array(
           (Array(1), 4L),
    -      (Array(1, 3), 2L),
    -      (Array(1, 3, 4), 2L),
    -      (Array(1, 3, 4, 5), 2L),
    -      (Array(1, 3, 5), 2L),
    -      (Array(1, 4), 2L),
    -      (Array(1, 4, 5), 2L),
    -      (Array(1, 5), 2L),
    +      (Array(1, -1, 3), 2L),
    +      (Array(1, -1, 3, -1, 4), 2L),
    +      (Array(1, -1, 3, -1, 4, -1, 5), 2L),
    +      (Array(1, -1, 3, -1, 5), 2L),
    +      (Array(1, -1, 4), 2L),
    +      (Array(1, -1, 4, -1, 5), 2L),
    +      (Array(1, -1, 5), 2L),
           (Array(2), 2L),
    -      (Array(2, 1), 2L),
    +      (Array(2, -1, 1), 2L),
           (Array(3), 5L),
    -      (Array(3, 1), 2L),
    -      (Array(3, 3), 2L),
    -      (Array(3, 4), 3L),
    -      (Array(3, 4, 5), 2L),
    -      (Array(3, 5), 2L),
    +      (Array(3, -1, 1), 2L),
    +      (Array(3, -1, 3), 2L),
    +      (Array(3, -1, 4), 3L),
    +      (Array(3, -1, 4, -1, 5), 2L),
    +      (Array(3, -1, 5), 2L),
           (Array(4), 4L),
    -      (Array(4, 5), 2L),
    +      (Array(4, -1, 5), 2L),
           (Array(5), 3L)
         )
    -    assert(compareResults(expectedValue1, result1.collect()))
    +    compareResults(expectedValue1, result1.collect())
     
         prefixspan.setMinSupport(0.5).setMaxPatternLength(50)
         val result2 = prefixspan.run(rdd)
         val expectedValue2 = Array(
           (Array(1), 4L),
           (Array(3), 5L),
    -      (Array(3, 4), 3L),
    +      (Array(3, -1, 4), 3L),
           (Array(4), 4L),
           (Array(5), 3L)
         )
    -    assert(compareResults(expectedValue2, result2.collect()))
    +    compareResults(expectedValue2, result2.collect())
     
         prefixspan.setMinSupport(0.33).setMaxPatternLength(2)
         val result3 = prefixspan.run(rdd)
         val expectedValue3 = Array(
           (Array(1), 4L),
    -      (Array(1, 3), 2L),
    -      (Array(1, 4), 2L),
    -      (Array(1, 5), 2L),
    -      (Array(2, 1), 2L),
    +      (Array(1, -1, 3), 2L),
    +      (Array(1, -1, 4), 2L),
    +      (Array(1, -1, 5), 2L),
    +      (Array(2, -1, 1), 2L),
           (Array(2), 2L),
           (Array(3), 5L),
    -      (Array(3, 1), 2L),
    -      (Array(3, 3), 2L),
    -      (Array(3, 4), 3L),
    -      (Array(3, 5), 2L),
    +      (Array(3, -1, 1), 2L),
    +      (Array(3, -1, 3), 2L),
    +      (Array(3, -1, 4), 3L),
    +      (Array(3, -1, 5), 2L),
           (Array(4), 4L),
    -      (Array(4, 5), 2L),
    +      (Array(4, -1, 5), 2L),
           (Array(5), 3L)
         )
    -    assert(compareResults(expectedValue3, result3.collect()))
    +    compareResults(expectedValue3, result3.collect())
    +  }
    +
    +  test("PrefixSpan using Integer type, variable-size itemsets") {
    +    val sequences = Array(
    +      Array(1, -1, 1, 2, 3, -1, 1, 3, -1, 4, -1, 3, 6),
    +      Array(1, 4, -1, 3, -1, 2, 3, -1, 1, 5),
    +      Array(5, 6, -1, 1, 2, -1, 4, 6, -1, 3, -1, 2),
    +      Array(5, -1, 7, -1, 1, 6, -1, 3, -1, 2, -1, 3))
    +    val rdd = sc.parallelize(sequences, 2).cache()
    +    val prefixspan = new 
PrefixSpan().setMinSupport(0.5).setMaxPatternLength(5)
    +    val result = prefixspan.run(rdd)
    +    val expectedValue = Array(
    --- End diff --
    
    OK


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to