Repository: spark Updated Branches: refs/heads/master 9e0893b53 -> 870b9d9aa
[SPARK-20026][DOC][SPARKR] Add Tweedie example for SparkR in programming guide ## What changes were proposed in this pull request? Add Tweedie example for SparkR in programming guide. The doc was already updated in #17103. Author: actuaryzhang <actuaryzhan...@gmail.com> Closes #17553 from actuaryzhang/programGuide. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/870b9d9a Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/870b9d9a Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/870b9d9a Branch: refs/heads/master Commit: 870b9d9aa00c260b532c78088e4a0384f7f1fa8a Parents: 9e0893b Author: actuaryzhang <actuaryzhan...@gmail.com> Authored: Fri Apr 7 10:57:12 2017 -0700 Committer: Felix Cheung <felixche...@apache.org> Committed: Fri Apr 7 10:57:12 2017 -0700 ---------------------------------------------------------------------- examples/src/main/r/ml/glm.R | 9 +++++++++ 1 file changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/870b9d9a/examples/src/main/r/ml/glm.R ---------------------------------------------------------------------- diff --git a/examples/src/main/r/ml/glm.R b/examples/src/main/r/ml/glm.R index ee13910..23141b5 100644 --- a/examples/src/main/r/ml/glm.R +++ b/examples/src/main/r/ml/glm.R @@ -56,6 +56,15 @@ summary(binomialGLM) # Prediction binomialPredictions <- predict(binomialGLM, binomialTestDF) head(binomialPredictions) + +# Fit a generalized linear model of family "tweedie" with spark.glm +training3 <- read.df("data/mllib/sample_multiclass_classification_data.txt", source = "libsvm") +tweedieDF <- transform(training3, label = training3$label * exp(randn(10))) +tweedieGLM <- spark.glm(tweedieDF, label ~ features, family = "tweedie", + var.power = 1.2, link.power = 0) + +# Model summary +summary(tweedieGLM) # $example off$ sparkR.session.stop() --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org