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

    https://github.com/apache/spark/pull/16715#discussion_r100192347
  
    --- Diff: python/pyspark/ml/feature.py ---
    @@ -120,6 +122,200 @@ def getThreshold(self):
             return self.getOrDefault(self.threshold)
     
     
    +class LSHParams(Params):
    +    """
    +    Mixin for Locality Sensitive Hashing(LSH) algorithm parameters.
    +    """
    +
    +    numHashTables = Param(Params._dummy(), "numHashTables", "number of 
hash tables, where " +
    +                          "increasing number of hash tables lowers the 
false negative rate, " +
    +                          "and decreasing it improves the running 
performance.",
    +                          typeConverter=TypeConverters.toInt)
    +
    +    def __init__(self):
    +        super(LSHParams, self).__init__()
    +
    +    @since("2.2.0")
    +    def setNumHashTables(self, value):
    +        """
    +        Sets the value of :py:attr:`numHashTables`.
    +        """
    +        return self._set(numHashTables=value)
    +
    +    @since("2.2.0")
    +    def getNumHashTables(self):
    +        """
    +        Gets the value of numHashTables or its default value.
    +        """
    +        return self.getOrDefault(self.numHashTables)
    +
    +
    +class LSHModel():
    +    """
    +    Mixin for Locality Sensitive Hashing(LSH) models.
    +    """
    +
    +    @since("2.2.0")
    +    def approxNearestNeighbors(self, dataset, key, numNearestNeighbors, 
singleProbing=True,
    +                               distCol="distCol"):
    +        """
    +        Given a large dataset and an item, approximately find at most k 
items which have the
    +        closest distance to the item. If the :py:attr:`outputCol` is 
missing, the method will
    +        transform the data; if the :py:attr:`outputCol` exists, it will 
use that. This allows
    +        caching of the transformed data when necessary.
    +
    +        :param dataset: The dataset to search for nearest neighbors of the 
key.
    +        :param key: Feature vector representing the item to search for.
    +        :param numNearestNeighbors: The maximum number of nearest 
neighbors.
    +        :param distCol: Output column for storing the distance between 
each result row and the key.
    +                        Use "distCol" as default value if it's not 
specified.
    +        :return: A dataset containing at most k items closest to the key. 
A distCol is added
    +                 to show the distance between each row and the key.
    +        """
    +        return self._call_java("approxNearestNeighbors", dataset, key, 
numNearestNeighbors,
    +                               distCol)
    +
    +    @since("2.2.0")
    +    def approxSimilarityJoin(self, datasetA, datasetB, threshold, 
distCol="distCol"):
    +        """
    +        Join two dataset to approximately find all pairs of rows whose 
distance are smaller than
    --- End diff --
    
    Done.


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