Github user Yunni commented on a diff in the pull request: https://github.com/apache/spark/pull/16715#discussion_r100192333 --- 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. --- 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