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

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

Reply via email to