spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sethah <...@git.apache.org>
Subject [GitHub] spark pull request #15874: [Spark-18408] API Improvements for LSH
Date Tue, 15 Nov 2016 01:06:35 GMT
Github user sethah commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15874#discussion_r87928721
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/feature/BucketedRandomProjectionLSH.scala
---
    @@ -89,23 +90,25 @@ class RandomProjectionModel private[ml] (
       }
     
       @Since("2.1.0")
    -  override protected[ml] def hashDistance(x: Vector, y: Vector): Double = {
    +  override protected[ml] def hashDistance(x: Seq[Vector], y: Seq[Vector]): Double = {
         // Since it's generated by hashing, it will be a pair of dense vectors.
    -    x.toDense.values.zip(y.toDense.values).map(pair => math.abs(pair._1 - pair._2)).min
    +    x.zip(y).map(vectorPair => Vectors.sqdist(vectorPair._1, vectorPair._2)).min
       }
     
       @Since("2.1.0")
       override def copy(extra: ParamMap): this.type = defaultCopy(extra)
     
       @Since("2.1.0")
    -  override def write: MLWriter = new RandomProjectionModel.RandomProjectionModelWriter(this)
    +  override def write: MLWriter = {
    +    new BucketedRandomProjectionModel.BucketedRandomProjectionModelWriter(this)
    +  }
     }
     
     /**
      * :: Experimental ::
      *
    - * This [[RandomProjection]] implements Locality Sensitive Hashing functions for Euclidean
    - * distance metrics.
    + * This [[BucketedRandomProjectionLSH]] implements Locality Sensitive Hashing functions
for
    + * Euclidean distance metrics.
      *
      * The input is dense or sparse vectors, each of which represents a point in the Euclidean
      * distance space. The output will be vectors of configurable dimension. Hash value in
the same
    --- End diff --
    
    "Hash values in the same dimension are calculated"


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


Mime
View raw message