当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Python pyspark IndexedRowMatrix.computeGramianMatrix用法及代码示例


本文简要介绍 pyspark.mllib.linalg.distributed.IndexedRowMatrix.computeGramianMatrix 的用法。

用法:

computeGramianMatrix()

计算 Gramian 矩阵 A^T A

2.0.0 版中的新函数。

注意

这不能在超过 65535 列的矩阵上计算。

例子

>>> rows = sc.parallelize([IndexedRow(0, [1, 2, 3]),
...                        IndexedRow(1, [4, 5, 6])])
>>> mat = IndexedRowMatrix(rows)
>>> mat.computeGramianMatrix()
DenseMatrix(3, 3, [17.0, 22.0, 27.0, 22.0, 29.0, 36.0, 27.0, 36.0, 45.0], 0)

相关用法


注:本文由纯净天空筛选整理自spark.apache.org大神的英文原创作品 pyspark.mllib.linalg.distributed.IndexedRowMatrix.computeGramianMatrix。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。