Learn R Programming

kernelFactory (version 0.3.0)

predict.kernelFactory: Predict method for kernelFactory objects

Description

Prediction of new data using kernelFactory.

Usage

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

Arguments

object
An object of class kernelFactory, as created by the function kernelFactory
newdata
A data frame with the same predictors as in the training data.
predict.all
TRUE or FALSE. If TRUE and rp and cp are 1 then the individual predictions of the random forest are returned. If TRUE and any of rp and cp or bigger than 1 then the predictions of all the members are returned.
...
Not used currently.

Value

A vector containing the response probabilities.

References

Ballings, M. and Van den Poel, D. (2013), Kernel Factory: An Ensemble of Kernel Machines. Expert Systems With Applications, 40(8), 2904-2913.

See Also

kernelFactory

Examples

Run this code
#Credit Approval data available at UCI Machine Learning Repository
data(Credit)
#take subset (for the purpose of a quick example) and train and test
Credit <- Credit[1:100,]
train.ind <- sample(nrow(Credit),round(0.5*nrow(Credit)))

#Train Kernel Factory on training data
kFmodel <- kernelFactory(x=Credit[train.ind,names(Credit)!= "Response"],
          y=Credit[train.ind,"Response"], method=random)

#Deploy Kernel Factory to predict response for test data
predictedresponse <- predict(kFmodel, newdata=Credit[-train.ind,names(Credit)!= "Response"])

Run the code above in your browser using DataLab