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

    https://github.com/apache/spark/pull/15874#discussion_r88359545
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/feature/BucketedRandomProjectionLSHSuite.scala
 ---
    @@ -115,64 +117,83 @@ class RandomProjectionSuite
         val df = spark.createDataFrame(data.map(Tuple1.apply)).toDF("keys")
     
         // Project from 100 dimensional Euclidean Space to 10 dimensions
    -    val rp = new RandomProjection()
    -      .setOutputDim(10)
    +    val brp = new BucketedRandomProjectionLSH()
    +      .setNumHashTables(10)
           .setInputCol("keys")
           .setOutputCol("values")
           .setBucketLength(2.5)
           .setSeed(12345)
     
    -    val (falsePositive, falseNegative) = LSHTest.calculateLSHProperty(df, 
rp, 3.0, 2.0)
    +    val (falsePositive, falseNegative) = LSHTest.calculateLSHProperty(df, 
brp, 3.0, 2.0)
         assert(falsePositive < 0.3)
         assert(falseNegative < 0.3)
       }
     
    -  test("approxNearestNeighbors for random projection") {
    +  test("approxNearestNeighbors for bucketed random projection") {
         val key = Vectors.dense(1.2, 3.4)
     
    -    val rp = new RandomProjection()
    -      .setOutputDim(2)
    +    val brp = new BucketedRandomProjectionLSH()
    +      .setNumHashTables(2)
           .setInputCol("keys")
           .setOutputCol("values")
           .setBucketLength(4.0)
           .setSeed(12345)
     
    -    val (precision, recall) = LSHTest.calculateApproxNearestNeighbors(rp, 
dataset, key, 100,
    -      singleProbing = true)
    +    val (precision, recall) = LSHTest.calculateApproxNearestNeighbors(brp, 
dataset, key, 100,
    +      singleProbe = true)
         assert(precision >= 0.6)
         assert(recall >= 0.6)
       }
     
       test("approxNearestNeighbors with multiple probing") {
         val key = Vectors.dense(1.2, 3.4)
     
    -    val rp = new RandomProjection()
    -      .setOutputDim(20)
    +    val brp = new BucketedRandomProjectionLSH()
    +      .setNumHashTables(20)
           .setInputCol("keys")
           .setOutputCol("values")
           .setBucketLength(1.0)
           .setSeed(12345)
     
    -    val (precision, recall) = LSHTest.calculateApproxNearestNeighbors(rp, 
dataset, key, 100,
    -      singleProbing = false)
    +    val (precision, recall) = LSHTest.calculateApproxNearestNeighbors(brp, 
dataset, key, 100,
    +      singleProbe = false)
         assert(precision >= 0.7)
         assert(recall >= 0.7)
       }
     
    -  test("approxSimilarityJoin for random projection on different dataset") {
    +  test("approxNearestNeighbors for numNeighbors <= 0") {
    +    val key = Vectors.dense(1.2, 3.4)
    +
    +    val brp = new BucketedRandomProjectionLSH()
    +      .setNumHashTables(20)
    --- End diff --
    
    No need to set some of these Params here


---
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