You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by NarineK <gi...@git.apache.org> on 2015/10/30 01:28:57 UTC

[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

GitHub user NarineK opened a pull request:

    https://github.com/apache/spark/pull/9366

    [SPARK-11057] [SQL] Add correlation and covariance matrices

    Hi there,
    
    As we know R has the option to calculate the correlation and covariance for all columns of a dataframe or between columns of two dataframes.
    
    If we look at apache math package we can see that, they have that too. 
    http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html#computeCorrelationMatrix%28org.apache.commons.math3.linear.RealMatrix%29
    
    In case we have as input only one DataFrame:
    ------------------------------------------------------
    
    for correlation:
    cor[i,j] = cor[j,i]
    and for the main diagonal we can have 1s.
    
    ---------------------
    for covariance: 
    cov[i,j] = cov[j,i]
    and for main diagonal: we can compute the variance for that specific column:
    See:
    http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/stat/correlation/Covariance.html#computeCovarianceMatrix%28org.apache.commons.math3.linear.RealMatrix%29
    
    Thanks,
    Narine

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/NarineK/spark sparksqlcorcov

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/9366.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #9366
    
----
commit 74bdf5451dd92de10acfea3e1db9cd3325bf6dd7
Author: Narine Kokhlikyan <na...@gmail.com>
Date:   2015-10-29T14:49:55Z

    Initial commit for correelation and covariance matrices

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by sun-rui <gi...@git.apache.org>.
Github user sun-rui commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9366#discussion_r44898159
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/stat/StatFunctions.scala ---
    @@ -33,6 +34,31 @@ private[sql] object StatFunctions extends Logging {
         counts.Ck / math.sqrt(counts.MkX * counts.MkY)
       }
     
    +  /** Calculate the Pearson Correlation matrix for given DataFrame */
    +  private[sql] def pearsonCorrelation(df: DataFrame): DataFrame = {
    +    val fieldNames = df.schema.fieldNames
    +    val dfStructAttrs = ArrayBuffer[AttributeReference](
    +              AttributeReference("FieldName", StringType, true)())
    +    val rows = fieldNames.map{fname => val countsRow = new GenericMutableRow(fieldNames.length + 1)
    +        countsRow.update(0, UTF8String.fromString(fname))
    +        countsRow
    +    }.toSeq
    +    // generates field types of the output DataFrame
    +    for(field <- fieldNames) dfStructAttrs += AttributeReference(field, DoubleType, true)()
    +
    +    // fills the correlation matrix by computing column-by-column correlations
    +    for (i <- 0 to fieldNames.length - 1){
    +      for (j <- 0 to i){
    +          val corr = pearsonCorrelation(df, Seq(fieldNames(i), fieldNames(j)))
    --- End diff --
    
    You can't assume all columns are of numeric type. Catch exception here and use null as value if exception happens?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-152368326
  
    **[Test build #44651 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44651/consoleFull)** for PR 9366 at commit [`74bdf54`](https://github.com/apache/spark/commit/74bdf5451dd92de10acfea3e1db9cd3325bf6dd7).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-152395101
  
    **[Test build #44651 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44651/consoleFull)** for PR 9366 at commit [`74bdf54`](https://github.com/apache/spark/commit/74bdf5451dd92de10acfea3e1db9cd3325bf6dd7).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by shivaram <gi...@git.apache.org>.
Github user shivaram commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-152387852
  
    cc @mengxr


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-152395201
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/44651/
    Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by sjjpo2002 <gi...@git.apache.org>.
Github user sjjpo2002 commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-213601727
  
    I have been trying to use correlation on a matrix with many columns. @NarineK menthioned R like correlation. I wish we had something like what [pandas](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.corr.html) offers. It handles missing data automatically. Take a look [here](http://stackoverflow.com/questions/31619578/numpy-corrcoef-compute-correlation-matrix-while-ignoring-missing-data). Even the [corr()](http://spark.apache.org/docs/latest/api/python/pyspark.mllib.html#pyspark.mllib.stat.Statistics) function from MLlib can not handle missing data. These features are really missing from SparkSQL:
    
    - Apply correlation on all columns and return a matrix
    
    - Handle missing data automatically like how [pandas ](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.corr.html)does



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-152366240
  
    Merged build started.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by shivaram <gi...@git.apache.org>.
Github user shivaram commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-212027249
  
    cc @mengxr 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-211595872
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/56142/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-197222706
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/53308/
    Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #9366: [SPARK-11057] [SQL] Add correlation and covariance matric...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/9366
  
    We are closing it due to inactivity. please do reopen if you want to push it forward. Thanks!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-197222703
  
    Build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-211594847
  
      [Test build #56142 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56142/consoleFull) for   PR 9366 at commit [`74bdf54`](https://github.com/apache/spark/commit/74bdf5451dd92de10acfea3e1db9cd3325bf6dd7).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by sun-rui <gi...@git.apache.org>.
Github user sun-rui commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9366#discussion_r44898137
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/stat/StatFunctions.scala ---
    @@ -102,6 +128,34 @@ private[sql] object StatFunctions extends Logging {
         counts.cov
       }
     
    + /**
    +   * Calculate the covariance of two numerical columns of a DataFrame.
    +   * @param df The DataFrame
    +   * @return the covariance matrix.
    +   */
    +  private[sql] def calculateCov(df: DataFrame): DataFrame = {
    +    val fieldNames = df.schema.fieldNames
    +    val dfStructAttrs = ArrayBuffer[AttributeReference](
    +             AttributeReference("FieldName", StringType, true)())
    +    val rows = fieldNames.map{fname => val countsRow = new GenericMutableRow(fieldNames.length + 1)
    +        countsRow.update(0, UTF8String.fromString(fname))
    +        countsRow
    +    }.toSeq
    +    // generates field types of the output DataFrame
    +    for(field <- fieldNames) dfStructAttrs += AttributeReference(field, DoubleType, true)()
    +
    +    // fills the covariance matrix by computing column-by-column covariances
    +    for (i <- 0 to fieldNames.length-1){
    +      for (j <- 0 to i){
    +          val cov = calculateCov(df, Seq(fieldNames(i), fieldNames(j)))
    --- End diff --
    
    You can't assume all columns are of numeric type. Catch exception here and use null as value if exception happens?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-197222693
  
      [Test build #53308 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/53308/console) for   PR 9366 at commit [`74bdf54`](https://github.com/apache/spark/commit/74bdf5451dd92de10acfea3e1db9cd3325bf6dd7).
     * This patch **fails R style tests**.
     * This patch **does not merge cleanly**.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #9366: [SPARK-11057] [SQL] Add correlation and covariance...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/9366


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by NarineK <gi...@git.apache.org>.
Github user NarineK commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-157034131
  
    Hi @sun-rui,
    thank you for your comment. In general, I think that, it might be better to verify all columns types and make sure that we are dealing with numeric fields. if any of the fields isn't numeric we can show an error message, similar to R.
     cor(iris)
    Error in cor(iris) : 'x' must be numeric


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-211595870
  
    Build finished. Test FAILed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by NarineK <gi...@git.apache.org>.
Github user NarineK commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9366#discussion_r44926444
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/stat/StatFunctions.scala ---
    @@ -33,6 +34,31 @@ private[sql] object StatFunctions extends Logging {
         counts.Ck / math.sqrt(counts.MkX * counts.MkY)
       }
     
    +  /** Calculate the Pearson Correlation matrix for given DataFrame */
    +  private[sql] def pearsonCorrelation(df: DataFrame): DataFrame = {
    +    val fieldNames = df.schema.fieldNames
    +    val dfStructAttrs = ArrayBuffer[AttributeReference](
    +              AttributeReference("FieldName", StringType, true)())
    +    val rows = fieldNames.map{fname => val countsRow = new GenericMutableRow(fieldNames.length + 1)
    +        countsRow.update(0, UTF8String.fromString(fname))
    +        countsRow
    +    }.toSeq
    +    // generates field types of the output DataFrame
    +    for(field <- fieldNames) dfStructAttrs += AttributeReference(field, DoubleType, true)()
    +
    +    // fills the correlation matrix by computing column-by-column correlations
    +    for (i <- 0 to fieldNames.length - 1){
    +      for (j <- 0 to i){
    +          val corr = pearsonCorrelation(df, Seq(fieldNames(i), fieldNames(j)))
    --- End diff --
    
    I'm not sure if showing null is valid. If not numeric then not showing anything, I think so .... 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-152366155
  
     Merged build triggered.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-152395199
  
    Merged build finished. Test PASSed.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #9366: [SPARK-11057] [SQL] Add correlation and covariance matric...

Posted by gatorsmile <gi...@git.apache.org>.
Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/9366
  
    @NarineK Are you still working on this? cc @yanboliang 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-197221753
  
      [Test build #53308 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/53308/consoleFull) for   PR 9366 at commit [`74bdf54`](https://github.com/apache/spark/commit/74bdf5451dd92de10acfea3e1db9cd3325bf6dd7).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-211595866
  
      [Test build #56142 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/56142/console) for   PR 9366 at commit [`74bdf54`](https://github.com/apache/spark/commit/74bdf5451dd92de10acfea3e1db9cd3325bf6dd7).
     * This patch **fails R style tests**.
     * This patch **does not merge cleanly**.
     * This patch adds no public classes.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by NarineK <gi...@git.apache.org>.
Github user NarineK commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-155171975
  
    In general I think that currently there are some issues in the StatFunctions.scala: 
    
    It seems that all computations both for covariance and correlation are being accomplished in one place which makes it a little confusing and harder to extend for the future.	  
    
    collectStatisticalData method is called for both correlation and covariance and even if I call something like this:
       df.stats.corr("numeric_colame", "string_colname")
    I get an error like this: 
         java.lang.IllegalArgumentException: requirement failed: **Covariance** calculation for columns with dataType StringType not supported.
    
     Here is an example: 
    These 2 variables are being computed each time when we compute covariance, however, are being used only for correlation:
        var MkX = 0.0 // sum of squares of differences from the (current) mean for col1
        var MkY = 0.0 // sum of squares of differences from the (current) mean for col2
    	
    I think we can actually separate the computations. Is there a reason why these computations are being accomplished in one place ? @rxin, @mengxr 
    	


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by NarineK <gi...@git.apache.org>.
Github user NarineK commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-152366433
  
    @shivaram , @rxin , would you guys, please, take a look at this ?
    Thanks!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by NarineK <gi...@git.apache.org>.
Github user NarineK commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-153971976
  
    Hi guys, would you share your thoughts about this ? 
    Thanks!


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-11057] [SQL] Add correlation and covari...

Posted by NarineK <gi...@git.apache.org>.
Github user NarineK commented on the pull request:

    https://github.com/apache/spark/pull/9366#issuecomment-157034350
  
    what do you think ?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org