Skip to content

Commit c4ef04b

Browse files
committed
add tweeide example for SparkR in programming guide
1 parent 5a693b4 commit c4ef04b

File tree

1 file changed

+9
-0
lines changed
  • examples/src/main/r/ml

1 file changed

+9
-0
lines changed

examples/src/main/r/ml/glm.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ summary(binomialGLM)
5656
# Prediction
5757
binomialPredictions <- predict(binomialGLM, binomialTestDF)
5858
head(binomialPredictions)
59+
60+
# Fit a generalized linear model of family "tweedie" with spark.glm
61+
training3 <- read.df("data/mllib/sample_multiclass_classification_data.txt", source = "libsvm")
62+
tweedieDF <- transform(training3, label= training3$label * exp(randn(10)))
63+
tweedieGLM <- spark.glm(tweedieDF, label ~ features, family = "tweedie",
64+
var.power = 1.2, link.power = 0)
65+
66+
# Model summary
67+
summary(tweedieGLM)
5968
# $example off$
6069

6170
sparkR.session.stop()

0 commit comments

Comments
 (0)