Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/5858#discussion_r29557460
--- 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 --
Oh, they canceled each other. Could you add a non-trivial test to Scala?
Now it only has `0.0`, `1.0`, and `-1.0`. In your test, please provide Python/R
commands in comments to reproduce the result. This makes easier for others to
verify.
---
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]