Skip to content
Snippets Groups Projects
Commit 870b9d9a authored by actuaryzhang's avatar actuaryzhang Committed by Felix Cheung
Browse files

[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.
parent 9e0893b5
No related branches found
No related tags found
No related merge requests found
......@@ -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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment