spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From actuaryzhang <>
Subject [GitHub] spark issue #16699: [SPARK-18710][ML] Add offset in GLM
Date Mon, 13 Feb 2017 23:04:34 GMT
Github user actuaryzhang commented on the issue:
    @sethah The predict method can work with new data in R. See below. Shall we focus on the
current implementation, instead of discussing the details of the R behavior? :) 
    Let me know if there is any suggestion on the last commit. Thanks. 
    df <- data.frame(y = rnorm(10), x = rnorm(10), off = rnorm(10))
    model <- glm(y ~ x, data = df, offset = off)
    df2 <- data.frame(y = rnorm(20), x = rnorm(20), off = rnorm(20))
    p1 <- predict(model, df2, type = "response")
    p2 <- as.numeric(model.matrix(y~x, df2) %*% coef(model) + df2$off)
    sum(p1 - p2)

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

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message