# NOT RUN {
devAskNewPage(ask = TRUE)
data("adult")
# Find complete cases.
adult <- adult[complete.cases(adult),]
# Replace levels with numbers.
adult <- as.data.frame(data.matrix(adult))
# Find numbers of levels.
cmax <- unlist(lapply(apply(adult[, c(-1, -16)], 2, unique), length))
cmax
# Split adult dataset into train and test subsets for two Incomes
# and remove Type and Income columns.
Adult <- split(p = list(type = 1, train = 2, test = 1),
Dataset = adult, class = 16)
# Estimate number of components, component weights and component parameters
# for the set of chunks 1:14.
adultest <- list()
for (i in 1:14) {
adultest[[i]] <- REBMIX(Dataset = chunk(Adult, i)@train,
Preprocessing = "histogram",
cmax = min(120, cmax[i]),
Criterion = "BIC",
pdf = "Dirac",
K = 1)
}
# Class membership prediction based upon the best first search algorithm.
adultcla <- BFSMIX(x = adultest,
Dataset = Adult@test,
Zt = Adult@Zt)
adultcla
summary(adultcla)
# Plot selected chunks.
plot(adultcla, nrow = 5, ncol = 2)
# }
Run the code above in your browser using DataLab