Github user dorx commented on a diff in the pull request:
https://github.com/apache/spark/pull/1713#discussion_r15717671
--- Diff:
mllib/src/main/scala/org/apache/spark/mllib/stat/correlation/Correlation.scala
---
@@ -49,43 +49,48 @@ private[stat] trait Correlation {
}
/**
- * Delegates computation to the specific correlation object based on the
input method name
- *
- * Currently supported correlations: pearson, spearman.
- * After new correlation algorithms are added, please update the
documentation here and in
- * Statistics.scala for the correlation APIs.
- *
- * Maintains the default correlation type, pearson
+ * Delegates computation to the specific correlation object based on the
input method name.
*/
private[stat] object Correlations {
- // Note: after new types of correlations are implemented, please update
this map
- val nameToObjectMap = Map(("pearson", PearsonCorrelation), ("spearman",
SpearmanCorrelation))
- val defaultCorrName: String = "pearson"
- val defaultCorr: Correlation = nameToObjectMap(defaultCorrName)
-
- def corr(x: RDD[Double], y: RDD[Double], method: String =
defaultCorrName): Double = {
+ def corr(x: RDD[Double],
+ y: RDD[Double],
+ method: String = CorrelationNames.defaultCorrName): Double = {
val correlation = getCorrelationFromName(method)
correlation.computeCorrelation(x, y)
}
- def corrMatrix(X: RDD[Vector], method: String = defaultCorrName): Matrix
= {
+ def corrMatrix(X: RDD[Vector],
--- End diff --
@mengxr Is this what you meant? This isn't public and done to avoid
confusing the scala compiler.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---