我使用approxSimilarityJoin来找到两组之间的Jaccard相似性.
val dfA = hashtoseq.toDF("id","values") //values is a set of string
val hashingTF = new HashingTF().setInputCol("values").setOutputCol("features").setNumFeatures(1048576)
val featurizedData = hashingTF.transform(dfA)
val mh = new MinHashLSH()
.setNumHashTables(3)
.setInputCol("features")
.setOutputCol("hashes")
val model = mh.fit(featurizedData)
val dffilter = model.approxSimilarityJoin(featurizedData, featurizedData, 0.45)
Run Code Online (Sandbox Code Playgroud)
我正在为16 GB数据集写入大约270 GB的内容,甚至在服务器上也需要超过3小时(3个工作节点,每个节点有64 GB RAM和64个内核).
我经历了以下链接: -
[ LSH Spark永远停留在approxSimilarityJoin()函数,但它对我不起作用.
我也经历过databricks网站,他们将运行时与数据大小进行了比较.对于MB中的数据,即436 MB,大约相似度需要25分钟.对于GB中的数据集,它的创建问题.[ https://databricks.com/blog/2017/05/09/detecting-abuse-scale-locality-sensitive-hashing-uber-engineering.html].
我们可以通过在代码/服务器配置中进行一些更改或者使用approxSimilarityJoin函数来减少这种随机写入吗?还有其他有效的方法可以在大型数据集上计算Jaccard相似度吗?