本文简要介绍
pyspark.mllib.linalg.distributed.BlockMatrix.toIndexedRowMatrix
的用法。用法:
toIndexedRowMatrix()
将此矩阵转换为 IndexedRowMatrix。
例子:
>>> blocks = sc.parallelize([((0, 0), Matrices.dense(3, 2, [1, 2, 3, 4, 5, 6])), ... ((1, 0), Matrices.dense(3, 2, [7, 8, 9, 10, 11, 12]))]) >>> mat = BlockMatrix(blocks, 3, 2).toIndexedRowMatrix()
>>> # This BlockMatrix will have 6 effective rows, due to >>> # having two sub-matrix blocks stacked, each with 3 rows. >>> # The ensuing IndexedRowMatrix will also have 6 rows. >>> print(mat.numRows()) 6
>>> # This BlockMatrix will have 2 effective columns, due to >>> # having two sub-matrix blocks stacked, each with 2 columns. >>> # The ensuing IndexedRowMatrix will also have 2 columns. >>> print(mat.numCols()) 2
相关用法
- Python pyspark BlockMatrix.toLocalMatrix用法及代码示例
- Python pyspark BlockMatrix.toCoordinateMatrix用法及代码示例
- Python pyspark BlockMatrix.transpose用法及代码示例
- Python pyspark BlockMatrix.add用法及代码示例
- Python pyspark BlockMatrix.colsPerBlock用法及代码示例
- Python pyspark BlockMatrix.subtract用法及代码示例
- Python pyspark BlockMatrix.rowsPerBlock用法及代码示例
- Python pyspark BlockMatrix.numCols用法及代码示例
- Python pyspark BlockMatrix.numColBlocks用法及代码示例
- Python pyspark BlockMatrix.numRowBlocks用法及代码示例
- Python pyspark BlockMatrix.numRows用法及代码示例
- Python pyspark BlockMatrix.multiply用法及代码示例
- Python pyspark BlockMatrix.blocks用法及代码示例
- Python pyspark BisectingKMeans用法及代码示例
- Python pyspark Bucketizer用法及代码示例
- Python pyspark BinaryClassificationEvaluator用法及代码示例
- Python pyspark BucketedRandomProjectionLSH用法及代码示例
- Python pyspark BinaryClassificationMetrics用法及代码示例
- Python pyspark BisectingKMeansModel用法及代码示例
- Python pyspark Broadcast用法及代码示例
- Python pyspark Binarizer用法及代码示例
- Python pyspark create_map用法及代码示例
- Python pyspark date_add用法及代码示例
- Python pyspark DataFrame.to_latex用法及代码示例
- Python pyspark DataStreamReader.schema用法及代码示例
注:本文由纯净天空筛选整理自spark.apache.org大神的英文原创作品 pyspark.mllib.linalg.distributed.BlockMatrix.toIndexedRowMatrix。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。