DenseMatrix

class pyspark.ml.linalg.DenseMatrix(numRows, numCols, values, isTransposed=False)[source]

Column-major dense matrix.

Methods

toArray()

Return a numpy.ndarray

toSparse()

Convert to SparseMatrix

Methods Documentation

toArray()[source]

Return a numpy.ndarray

Examples

>>> m = DenseMatrix(2, 2, range(4))
>>> m.toArray()
array([[ 0.,  2.],
       [ 1.,  3.]])
toSparse()[source]

Convert to SparseMatrix