Learn R Programming

rebmix (version 2.16.0)

RCLSMIX-methods: Predicts Class Membership Based Upon a Model Trained by REBMIX

Description

Returns as default the RCLSMIX algorithm output for mixtures of conditionally independent normal, lognormal, Weibull, gamma, Gumbel, binomial, Poisson, Dirac, uniform or von Mises component densities. If model equals "RCLSMVNORM" output for mixtures of multivariate normal component densities with unrestricted variance-covariance matrices is returned.

Usage

# S4 method for RCLSMIX
RCLSMIX(model = "RCLSMIX", x = list(), Dataset = data.frame(),
        Zt = factor(), ...)
## ... and for other signatures
# S4 method for RCLSMIX
summary(object, ...)
## ... and for other signatures

Value

Returns an object of class RCLSMIX or RCLSMVNORM.

Arguments

model

see Methods section below.

x

a list of objects of class REBMIX of length \(o\) obtained by running REBMIX on \(g = 1, \ldots, s\) train datasets \(Y_{\mathrm{train}g}\) all of length \(n_{\mathrm{train}g}\). For the train datasets the corresponding class membership \(\bm{\Omega}_{g}\) is known. This yields \(n_{\mathrm{train}} = \sum_{g = 1}^{s} n_{\mathrm{train}g}\), while \(Y_{\mathrm{train}q} \cap Y_{\mathrm{train}g} = \emptyset\) for all \(q \neq g\). Each object in the list corresponds to one chunk, e.g., \((y_{1j}, y_{3j})^{\top}\). The default value is list().

Dataset

a data frame containing test dataset \(Y_{\mathrm{test}}\) of length \(n_{\mathrm{test}}\). For the test dataset the corresponding class membership \(\bm{\Omega}_{g}\) is not known. The default value is data.frame().

Zt

a factor of true class membership \(\bm{\Omega}_{g}\) for the test dataset. The default value is factor().

object

see Methods section below.

...

currently not used.

Methods

signature(model = "RCLSMIX")

a character giving the default class name "RCLSMIX" for mixtures of conditionally independent normal, lognormal, Weibull, gamma, Gumbel, binomial, Poisson, Dirac, uniform or von Mises component densities.

signature(model = "RCLSMVNORM")

a character giving the class name "RCLSMVNORM" for mixtures of multivariate normal component densities with unrestricted variance-covariance matrices.

signature(object = "RCLSMIX")

an object of class RCLSMIX.

signature(object = "RCLSMVNORM")

an object of class RCLSMVNORM.

Author

Marko Nagode

References

R. O. Duda and P. E. Hart. Pattern Classification and Scene Analysis. John Wiley & Sons, New York, 1973.

Examples

Run this code
if (FALSE) {
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 = a.train(chunk(Adult, i)),
    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 = a.test(Adult),
  Zt = a.Zt(Adult))

adultcla

summary(adultcla)

# Plot selected chunks.

plot(adultcla, nrow = 5, ncol = 2)
}

Run the code above in your browser using DataLab