Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/16715#discussion_r100426237
--- Diff:
examples/src/main/java/org/apache/spark/examples/ml/JavaBucketedRandomProjectionLSHExample.java
---
@@ -71,25 +71,32 @@ public static void main(String[] args) {
BucketedRandomProjectionLSH mh = new BucketedRandomProjectionLSH()
.setBucketLength(2.0)
.setNumHashTables(3)
- .setInputCol("keys")
- .setOutputCol("values");
+ .setInputCol("features")
+ .setOutputCol("hashes");
BucketedRandomProjectionLSHModel model = mh.fit(dfA);
// Feature Transformation
+ System.out.println("The hashed dataset where hashed values are stored
in the column 'values':");
model.transform(dfA).show();
// Cache the transformed columns
Dataset<Row> transformedA = model.transform(dfA).cache();
Dataset<Row> transformedB = model.transform(dfB).cache();
// Approximate similarity join
+ System.out.println("Approximately joining dfA and dfB on distance
smaller than 1.5:");
model.approxSimilarityJoin(dfA, dfB, 1.5).show();
+ System.out.println("Joining cached datasets to avoid recomputing the
hash values:");
model.approxSimilarityJoin(transformedA, transformedB, 1.5).show();
+
// Self Join
+ System.out.println("Approximately self join of dfB on distance smaller
than 2.5:");
--- End diff --
I don't think the self join is necessary, but I'll defer to others. Also,
"Approximate self join" and it's dfA not dfB
---
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]