Spearman
Model API Type |
Function API |
|---|---|
ML API |
def corr(dataset: Dataset[_], column: String, method: String): DataFrame |
ML API
- Input and output
- Package name: org.apache.spark.ml.stat
- Class name: Correlation
- Method name: corr
- Input: training sample data (Dataset[_]). The following are mandatory fields.
Parameter
Value Type
Description
data
Dataset[Vector]
Matrix, which is stored by row.
column
String
Specifies columns for correlation matrix calculation.
method
String
Correlation matrix method, which can be spearman.
- Algorithm parameters
Parameter
Value Type
Default Value
Description
method
String
pearson
Method for solving the correlation matrix
Code API example:
1val mat_df = ml.stat.Correlation.corr(data,"matrix", method = "spearman")
- Output: Pearson correlation matrix
Parameter
Value Type
Description
df
DataFrame
Spearman correlation matrix. The column name is column + method.
- Example
val mat = stat.Correlation.corr(data, "matrix", "spearman")
Parent topic: Feature Engineering