Learn R Programming

GroupBN (version 1.2.0)

predict.groupbn: predict.groupbn

Description

Predict the target variable from a group Bayesian network

Usage

# S3 method for groupbn
predict(object, X.quanti, X.quali, rename.level=FALSE, return.data=FALSE,
new.fit=FALSE, debug=FALSE, ...)

Arguments

object

An object of class groupbn generated by the functions groupbn or groupbn_refinement

X.quanti

quantitative variables

X.quali

qualitative variables

rename.level

a boolean; if TRUE, all levels of categorical variables are renamed by integers. Default is FALSE.

return.data

a boolean; if TRUE, a list with predictions and group.data is returned instead of only predicitions. Default is FALSE.

new.fit

a boolean; if TRUE, the parameters are newly fit using the test data.

debug

a boolean, if TRUE, debugging messages are printed

...

further arguments

Value

Returns a dataframe with a column of predictions and a column of the target data. If the target is discrete, class probabilities are returned. Otherwise continuous scores are returned. If return.data is TRUE, additionally the transformed group data are returned.

Examples

Run this code
# NOT RUN {
#load example data
data(wine)
wine.test<-wine[wine$Soil%in%c("Reference", "Env1"),1:29]
wine.test$Soil<-factor(wine.test$Soil)
levels(wine.test$Soil)<-c("0", "1")

data(wine.groupbn.refined)
predict(wine.groupbn.refined, X.quanti=wine.test[,3:29], X.quali=wine.test[,1:2])
# }

Run the code above in your browser using DataLab