aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authoractuaryzhang <actuaryzhang10@gmail.com>2017-01-31 12:20:43 -0800
committerFelix Cheung <felixcheung@apache.org>2017-01-31 12:20:43 -0800
commitce112cec4f9bff222aa256893f94c316662a2a7e (patch)
treedcf7d9067865d2c7c2c1bfd717dd3ebf79f09993 /project
parent26a4cba3ffaadf382ca14980378965704ccef9ab (diff)
downloadspark-ce112cec4f9bff222aa256893f94c316662a2a7e.tar.gz
spark-ce112cec4f9bff222aa256893f94c316662a2a7e.tar.bz2
spark-ce112cec4f9bff222aa256893f94c316662a2a7e.zip
[SPARK-19395][SPARKR] Convert coefficients in summary to matrix
## What changes were proposed in this pull request? The `coefficients` component in model summary should be 'matrix' but the underlying structure is indeed list. This affects several models except for 'AFTSurvivalRegressionModel' which has the correct implementation. The fix is to first `unlist` the coefficients returned from the `callJMethod` before converting to matrix. An example illustrates the issues: ``` data(iris) df <- createDataFrame(iris) model <- spark.glm(df, Sepal_Length ~ Sepal_Width, family = "gaussian") s <- summary(model) > str(s$coefficients) List of 8 $ : num 6.53 $ : num -0.223 $ : num 0.479 $ : num 0.155 $ : num 13.6 $ : num -1.44 $ : num 0 $ : num 0.152 - attr(*, "dim")= int [1:2] 2 4 - attr(*, "dimnames")=List of 2 ..$ : chr [1:2] "(Intercept)" "Sepal_Width" ..$ : chr [1:4] "Estimate" "Std. Error" "t value" "Pr(>|t|)" > s$coefficients[, 2] $`(Intercept)` [1] 0.4788963 $Sepal_Width [1] 0.1550809 ``` This shows that the underlying structure of coefficients is still `list`. felixcheung wangmiao1981 Author: actuaryzhang <actuaryzhang10@gmail.com> Closes #16730 from actuaryzhang/sparkRCoef.
Diffstat (limited to 'project')
0 files changed, 0 insertions, 0 deletions