Uh oh!
There was an error while loading. Please reload this page.
[SPARK-11715][SPARKR] Add R support corr for Column Aggregration - #9680
[SPARK-11715][SPARKR] Add R support corr for Column Aggregration#9680felixcheung wants to merge 4 commits into
Conversation
SparkQA
commented
Nov 13, 2015
Test build #45789 has finished for PR 9680 at commit
|
shivaram
commented
Nov 13, 2015
felixcheung
commented
Nov 13, 2015
I think 9366 is about computing corr or cov matrix whereas this is computing corr between two columns. They seem to be useful in their own ways. Also this is already supported in Scala and Python. |
NarineK
commented
Nov 13, 2015
in R the general formula for correlation is the following: |
felixcheung
commented
Nov 13, 2015
sun-rui
commented
Nov 16, 2015
these are two different issues. |
There was a problem hiding this comment.
this signature looks confusing. Maybe change the generic function definition of "corr" is better:
setGeneric("corr", function(x, ...) {standardGeneric("corr") })
setMethod("corr",
signature(x = "DataFrame"),
function(x, col1, col2, method = "pearson") {
...
}
setMethod("corr", signature(x = "characterOrColumn"),
function(x, col2) {
...
}
There was a problem hiding this comment.
One concern is how documentation for these "corr" methods are generated?
There was a problem hiding this comment.
right, I like the approach of changing the existing generic definition.
perhaps we should align the method signature with the stats::cor
cor(x, y = NULL, use = "everything",
method = c("pearson", "kendall", "spearman"))
do you know why we decide to name it corr (vs. cor) in other places?
There was a problem hiding this comment.
as for doc, the DataFrame corr in stats.R has @rdname statfunctions
this one has @rdname corr
so they go to different HTML page generated by roxygen2
There was a problem hiding this comment.
Maybe we can add cor() as alias for corr(), as you did in #9489
There was a problem hiding this comment.
Thinking more about this, I think what's being added in #9366 matches https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.html better. When we are adding that support in R we could add it as cor matching stats::cor.
Meanwhile I'll change corr to what you suggested with function(x, ...)
There was a problem hiding this comment.
#9366 only supports inter-column cov and cor of a DataFrame, not between columns of two DataFrames. I think actually it is better to add alias in this PR. corr() operating on two columns is similar to R cor() on two vectors.
felixcheung
commented
Nov 17, 2015
@sun-rui I updated it. I think it's a bit not as strongly typed as I'd like but if I add |
SparkQA
commented
Nov 17, 2015
Test build #46055 has finished for PR 9680 at commit
|
felixcheung
commented
Nov 17, 2015
any more comment? |
There was a problem hiding this comment.
There are two versions of corr():
def corr(column1: Column, column2: Column): Column
def corr(columnName1: String, columnName2: String): Column
We'd better support both. Something like:
setMethod("corr", signature(x = "characterOrColumn"),
There was a problem hiding this comment.
That's the same for count, max, mean and so on, so change we would need to change every function here - should we do that?
felixcheung
commented
Nov 19, 2015
@shivaram Can we go ahead with this? I think we could consider adding all character overload for DataFrame functions in a different JIRA. |
sun-rui
commented
Nov 19, 2015
adding all character overload for DataFrame functions in a different JIRA is OK. But for alias of corr(), #9366 only supports inter-column cov and cor of a DataFrame, not between columns of two DataFrames. I think actually it is better to add alias in this PR. corr() operating on two columns is similar to R cor() on two vectors. |
felixcheung
commented
Nov 19, 2015
As per this https://stat.ethz.ch/R-manual/R-devel/library/stats/html/cor.html |
felixcheung
commented
Nov 19, 2015
Also, since here we are working with 2 columns, by adding a alias |
felixcheung
commented
Nov 25, 2015
@sun-rui ? I"m fine with adding |
sun-rui
commented
Nov 30, 2015
@felixcheung, sorry for late response. Since there is no agreement now, I am fine that we don't add "cor" alias in this PR. Let's get this PR merged. Could you submit a new JIRA addressing the issue of adding alias of "cor" and also the issue of existing "cov" which masks stats::cov? |
sun-rui
commented
Nov 30, 2015
LGTM |
felixcheung
commented
Dec 1, 2015
stats::cov name conflict: https://issues.apache.org/jira/browse/SPARK-11886 |
felixcheung
commented
Dec 1, 2015
thanks, rebased. |
SparkQA
commented
Dec 1, 2015
Test build #46911 has finished for PR 9680 at commit
|
felixcheung
commented
Dec 1, 2015
second is a git error (seems like having a lot these days?) |
shivaram
commented
Dec 1, 2015
Jenkins, retest this please |
SparkQA
commented
Dec 1, 2015
Test build #46922 has finished for PR 9680 at commit
|
shivaram
commented
Dec 5, 2015
LGTM. @felixcheung I think the current resolution of not adding Merging this to master, branch-1.6 |
Need to match existing method signature