本文介绍了Spark中块矩阵乘法的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个具有900万行和85K列的坐标矩阵cmat。我想执行cmat.T * cmat操作。
我首先将cmat转换为块矩阵bmat:

pre $ b $ cmat.toBlockMatrix(1000,1000)

然而,我在执行multiply()时遇到错误: $ b

  mtm = bmat.transpose.multiply(bmat)

Traceback(最近的最后一次调用):
文件,第1行,在
中AttributeError:'function'object没有属性'multiply'

Spark版本为2.2.0,DataProc,Google云平台上的版本为2.11.8。
有关如何解决错误的建议?

解决方案

错误是说操作的结果 bmat.transpose 是一个函数,不是 blockMatrix ,因此没有属性 multiply



您只是缺少()

  mtm = bmat.transpose()。multiply(bmat)


I have created a coordinate matrix cmat with 9 million rows and 85K columns. I would like to perform cmat.T * cmat operations.I first converted cmat to block matrix bmat:

bmat = cmat.toBlockMatrix(1000, 1000)

However, I got errors when performing multiply():

mtm = bmat.transpose.multiply(bmat)

Traceback (most recent call last): File "", line 1, inAttributeError: 'function' object has no attribute 'multiply'

The Spark version is 2.2.0, scale version is 2.11.8 on DataProc, Google cloud platform.Any suggestions on how to fix the error?

解决方案

The error is saying that the result of operation bmat.transpose is a function not a blockMatrix and therefore has no attribute multiply.

You're just missing ():

mtm = bmat.transpose().multiply(bmat)

这篇关于Spark中块矩阵乘法的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 15:54