Learn R Programming

aCRM (version 0.1.1)

predict.cocktailEnsemble: Predict method for cocktailEnsemble objects.

Description

Prediction of new data using cocktailEnsemble. predict combines the predictions from all models contained in the cocktail by taking the mean of the probabilities.

Usage

"predict"(object, newdata=NULL,...)

Arguments

object
An object of class cocktailEnsemble, as created by the function cocktailEnsemble.
newdata
A data frame with the same predictors as in the training data.
...
Not used currently.

Value

A vector containing the probabilities of the predicted event.

References

Van den Poel, D., Ballings, M., Volkov, A., D''haen, J., Van Herwegen, M., Predictive Analytics for analytical Customer Relationship Management using SAS, Oracle and R, Springer, Forthcoming.

See Also

Other functions in this package: imputeMissings, Aggregate, cocktailEnsemble, predict.cocktailEnsemble

Examples

Run this code
#Credit Approval data available at UCI Machine Learning Repository
data(Credit)

#Create training set (take a small subset for demonstration purposes)
Credit <- data.frame(Credit[order(runif(nrow(Credit ))),])[1:100,c('V2','V3','V8','V11','V14','V15','Response')]
trainingset <- Credit[1:1:floor(0.50*nrow(Credit)),]
#Create test set
testset <- Credit[(floor(0.50*nrow(Credit))+1 ):nrow(Credit),]


#Train Cocktail Ensemble on training data
cE <- cocktailEnsemble(x=trainingset[,names(trainingset)!= "Response"],y=trainingset$Response)

#Deploy Kernel Factory to predict response for test data
pred <- predict(cE,testset[,names(testset)!= "Response"])

Run the code above in your browser using DataLab