Rate This Document
Findability
Accuracy
Completeness
Readability

Covariance

Model API Type

Function API

MLlib RowMatrix API

def computeCovariance (): Matrix

MLlib RowMatrix API

  • Function

    Input the matrix in the form of RDD[Vector] and output the covariance matrix.

  • Input/Output
    1. Package name: org.apache.spark.mllib.linalg.distributed
    2. Class name: RowMatrix
    3. Method name: computeCovariance
    4. Input: matrix (RowMatrix)

      Parameter

      Type

      Description

      rows

      RDD[Vector]

      Matrix, which is stored in the unit of row

      nRows

      Long

      Number of rows

      nCols

      Int

      Number of columns

    5. Algorithm parameters

      Code interface example:

      1
      2
       val matrix = new RowMatrix(data)
       val covMat = matrix.computeCovariance()
      
    6. Output: covariance matrix

      Parameter

      Type

      Description

      Mat

      Matrix

      Covariance matrix

  • Example
    1
    val mat = mat.computeCovariance ()