Obtaining the Best Model for Data Classification Using Labeled Data only

Share:

Description

This function performs supervised classification over a range of different models and finds the model that best fits the data. In selecting the best model, the BIC values are compared.

Usage

1
noupclassify(Xtrain, cltrain, Xtest, cltest = NULL, modelscope = NULL, ...)

Arguments

Xtrain

A numeric matrix of data where rows correspond to observations and columns correspond to variables. The group membership of each observation is known - labeled data.

cltrain

A numeric vector with distinct entries representing a classification of the corresponding observations in Xtrain

Xtest

A numeric matrix of data where rows correspond to observations and columns correspond to variables. The group membership of each observation may not be known - unlabeled data.

cltest

A numeric vector with distinct entries representing a classification of the corresponding observations in Xtest. By default, these are not supplied and the function sets out to obtain them.

modelscope

A character string indicating the desired models to be tested. With default NULL, all available models are tested. The models available for univariate and multivariate data are described in modelvec.

...

Arguments passed to or from other methods

Value

An object of class "upclassfit" providing a list of output components for each model in modelscope, with the Best model (according to BIC) first. The details of the output components are as follows

call

How to call the function and the order of its arguments.

Ntrain

The number of observations in the training set.

Ntest

The number of observations in the test set.

d

The dimension of the data.

G

The number of groups in the training set.

modelName

The model considered in this run of the algorithm.

parameters

A list of the model parameters estimated by Mclust.

pro

The proportion of the data to be found in each group.

mean

Mean vectors for each group.

variance

The variance and covariences produced by Mclust.

train

A list of information about the training data. This will not have changed from before the run.

z

A matrix containing the estimated probabilities that each observation in the training data belongs to each group.

cl

A vector containing the labels of the training data.

misclass

The number of misclassifications of the training data.

rate

The misclassification rate expressed as a percentage.

Brier

The Brier score expressed as a percentage.

tab

The misclassification table for the training data.

test

A list of information about the test data.

z

A matrix containing the estimated probabilities that each observation in the training data belongs to each group.

cl

A vector containing the new labels of the training data.

misclass

The number of misclassifications of the training data, provided the correct labels have been supplied.

rate

The misclassification rate expressed as a percentage, provided the correct labels have been supplied.

Brier

The Brier score expressed as a percentage.

tab

The misclassification table for the training data, provided the correct labels have been supplied.

ll

The log-likelihood of the data.

bic

The Bayes information criterion for the specified model.

Author(s)

Niamh Russell

References

Bensmail, H. and Celeux, G. (1996). Regularized gaussian discriminant analysis through eigenvalue decomposition. Journal of the American Statistical Association 91, 1743-1748.

C. Fraley and A.E. Raftery (2002). Model-based clustering, discriminant analysis, and density estimation. Journal of the American Statistical Association 97, 611-631.

C. Fraley and A.E. Raftery (2006) MCLUST Version 3 for R: Normal Mixture Modeling and Model-Based Clustering, Technical Report no. 504, Department of Statistics, University of Washington

See Also

upclassify, noupclassifymodel, modelvec

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
data(iris)
X<- as.matrix(iris[,-5])
cl<-as.matrix(iris[,5])

indtrain <- sort(sample(1:150, 30))
Xtrain <- X[indtrain,]
cltrain <- cl[indtrain]


indtest <- setdiff(1:150, indtrain)
Xtest <- X[indtest,]
cltest <- cl[indtest]


fitnoupmodels <- noupclassify(Xtrain, cltrain,
     Xtest, cltest)       #testing every model.
fitnoupmodels$Best$modelName