[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 <actuaryzhang10@gmail.com>

Closes #17553 from actuaryzhang/programGuide.
This commit is contained in:
actuaryzhang 2017-04-07 10:57:12 -07:00 committed by Felix Cheung
parent 9e0893b53d
commit 870b9d9aa0

View file

@ -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()