Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/5858#discussion_r29549089
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/stat/StatFunctions.scala
---
@@ -23,29 +23,43 @@ import org.apache.spark.sql.types.{DoubleType,
NumericType}
private[sql] object StatFunctions {
+ /** Calculate the Pearson Correlation Coefficient for the given columns
*/
+ private[sql] def pearsonCorrelation(df: DataFrame, cols: Seq[String]):
Double = {
+ val counts = collectStatisticalData(df, cols)
+ counts.Ck / math.sqrt(counts.MkX * counts.MkY)
--- End diff --
Should be the sample correlation as well. In the unit tests, please provide
R commands that compute the correlation and the result, and verify that we
output the same value.
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]