我正在计算两大组向量(具有相同特征)之间的余弦相似性。每组向量表示为一个scipy CSR稀疏矩阵a和B。我想计算一个x B^T,它不是稀疏的。但是,我只需要跟踪超过某个阈值的值,例如0.8。我正试图用vanillardds在Pyspark中实现这一点,其思想是使用为scipycrs矩阵实现的快速向量操作。你知道吗
A和B的行是标准化的,所以为了计算余弦相似性,我只需要找到A的每一行与B的每一行的点积。 A的尺寸为5000000 x 5000。 B的尺寸为2000000 x 5000。你知道吗
假设A和B太大,无法作为广播变量放入工作节点上的内存。我应该如何以最佳方式并行化A和B?你知道吗
编辑 发布解决方案后,我一直在探索其他更清晰、更优化的方法,特别是为Spark MLlib IndexedRowMatrix对象实现的columnComparison()函数。(Which pyspark abstraction is appropriate for my large matrix multiplication?)
我能够在这个框架中实现一个解决方案。
欢迎深入了解为什么这个解决方案很慢是因为自定义序列化吗?你知道吗
相关问题 更多 >
编程相关推荐