predict {SparkR}R Documentation

Make predictions from a generalized linear model

Description

Makes predictions from a generalized linear model produced by glm() or spark.glm(), similarly to R's predict().

Makes predictions from a model produced by spark.naiveBayes(), similarly to R package e1071's predict.

Make predictions from a model produced by spark.kmeans().

Make predictions from a model produced by spark.survreg(), similarly to R package survival's predict.

Usage

predict(object, ...)

## S4 method for signature 'GeneralizedLinearRegressionModel'
predict(object, newData)

## S4 method for signature 'NaiveBayesModel'
predict(object, newData)

## S4 method for signature 'KMeansModel'
predict(object, newData)

## S4 method for signature 'AFTSurvivalRegressionModel'
predict(object, newData)

Arguments

object

A fitted generalized linear model

newData

SparkDataFrame for testing

object

A fitted naive Bayes model

newData

SparkDataFrame for testing

object

A fitted k-means model

newData

SparkDataFrame for testing

object

A fitted AFT survival regression model

newData

SparkDataFrame for testing

Value

SparkDataFrame containing predicted labels in a column named "prediction"

SparkDataFrame containing predicted labels in a column named "prediction"

SparkDataFrame containing predicted labels in a column named "prediction"

SparkDataFrame containing predicted labels in a column named "prediction"

Examples

## Not run: 
##D model <- glm(y ~ x, trainingData)
##D predicted <- predict(model, testData)
##D showDF(predicted)
## End(Not run)
## Not run: 
##D model <- spark.naiveBayes(trainingData, y ~ x)
##D predicted <- predict(model, testData)
##D showDF(predicted)
## End(Not run)
## Not run: 
##D model <- spark.kmeans(trainingData, ~ ., 2)
##D predicted <- predict(model, testData)
##D showDF(predicted)
## End(Not run)
## Not run: 
##D model <- spark.survreg(trainingData, Surv(futime, fustat) ~ ecog_ps + rx)
##D predicted <- predict(model, testData)
##D showDF(predicted)
## End(Not run)

[Package SparkR version 2.0.0 Index]