Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/16511#discussion_r95207506
--- Diff: R/pkg/inst/tests/testthat/test_mllib_regression.R ---
@@ -61,14 +61,22 @@ test_that("spark.glm and predict", {
# poisson family
model <- spark.glm(training, Sepal_Width ~ Sepal_Length + Species,
- family = poisson(link = identity))
+ family = poisson(link = identity))
prediction <- predict(model, training)
expect_equal(typeof(take(select(prediction, "prediction"),
1)$prediction), "double")
vals <- collect(select(prediction, "prediction"))
rVals <- suppressWarnings(predict(glm(Sepal.Width ~ Sepal.Length +
Species,
- data = iris, family = poisson(link = identity)), iris))
+ data = iris, family = poisson(link
= identity)), iris))
expect_true(all(abs(rVals - vals) < 1e-6), rVals - vals)
+ # Gamma family
+ x <- runif(100, -1, 1)
+ y <- rgamma(100, rate = 10 / exp(0.5 + 1.2 * x), shape = 10)
+ df <- as.DataFrame(as.data.frame(list(x = x, y = y)))
+ model <- glm(y ~ x, family = Gamma, df)
--- End diff --
I'm not sure it matters much - as you can see in the code `glm` is a
single-line wrapper for `spark.glm` - I actually thought it was better to add
some tests for `glm` instead of just testing `spark.glm`
---
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]