Matrices

class pyspark.mllib.linalg.Matrices

Methods

dense(numRows, numCols, values)

Create a DenseMatrix

fromML(mat)

Convert a matrix from the new mllib-local representation.

sparse(numRows, numCols, colPtrs, …)

Create a SparseMatrix

Methods Documentation

static dense(numRows: int, numCols: int, values: Union[bytes, Iterable[float]])pyspark.mllib.linalg.DenseMatrix

Create a DenseMatrix

static fromML(mat: pyspark.ml.linalg.Matrix)pyspark.mllib.linalg.Matrix

Convert a matrix from the new mllib-local representation. This does NOT copy the data; it copies references.

Parameters
matpyspark.ml.linalg.Matrix
Returns
pyspark.mllib.linalg.Matrix
static sparse(numRows: int, numCols: int, colPtrs: Union[bytes, Iterable[int]], rowIndices: Union[bytes, Iterable[int]], values: Union[bytes, Iterable[float]])pyspark.mllib.linalg.SparseMatrix

Create a SparseMatrix