Learn R Programming

CMA (version 1.30.0)

prediction: General method for predicting classes of new observations

Description

This method constructs the given classifier using the specified training data, gene selection and tuning results.. Subsequently, class labels are predicted for new observations. For S4 method information, s. classification-methods.

Usage

prediction(X.tr,y.tr,X.new,f,classifier,genesel,models=F,nbgene,tuneres,...)

Arguments

X.tr
Training gene expression data. Can be one of the following:
  • A matrix. Rows correspond to observations, columns to variables.
  • A data.frame, when f is not missing (s. below).
  • An object of class ExpressionSet.

X.new
gene expression data. Can be one of the following:
  • A matrix. Rows correspond to observations, columns to variables.
  • A data.frame, when f is not missing (s. below).
  • An object of class ExpressionSet.
y.tr
Class labels of training observation. Can be one of the following:
  • A numeric vector.
  • A factor.
  • A character if X is an ExpressionSet that specifies the phenotype variable.
  • missing, if X is a data.frame and a proper formula f is provided.

WARNING: The class labels will be re-coded for classifier construction to range from 0 to K-1, where K is the total number of different classes in the learning set.

f
A two-sided formula, if X is a data.frame. The left part correspond to class labels, the right to variables.
genesel
Optional (but usually recommended) object of class genesel containing variable importance information for the argument learningsets. In this case the object contains a single variable selection. Appropriate genesel-objects can be obtained using the function genesel without learningset and setting X=X.tr and y=y.tr (i.e. corresponding to the training data of this function).
nbgene
Number of best genes to be kept for classification, based on either genesel or the call to GeneSelection using genesellist. In the case that both are missing, this argument is not necessary. note:
  • If the gene selection method has been one of "lasso", "elasticnet", "boosting", nbgene will be reset to min(s, nbgene) where s is the number of nonzero coefficients.
  • if the gene selection scheme has been "one-vs-all", "pairwise" for the multiclass case, there exist several rankings. The top nbgene will be kept of each of them, so the number of effective used genes will sometimes be much larger.

classifier
Name of function ending with CMA indicating the classifier to be used.
tuneres
Analogous to the argument genesel - object of class tuningresult containing information about the best hyperparameter choice for the argument learningsets. Appropriate tuning-objects can be obtained using the function tune without learningsets and setting parameters X=X.tr, y=y.tr and genesel=genesel (i.e. using the same training data and gene selection as in this function)
models
a logical value indicating whether the model object shall be returned
...
Further arguments passed to the function classifier.

Value

predoutput-class; Predicted classes can be seen by show(predoutput)

Details

This function builds the specified classifier and predicts the class labels of new observations. Hence, its usage differs from those of most other prediction functions in R.

References

Slawski, M. Daumer, M. Boulesteix, A.-L. (2008) CMA - A comprehensive Bioconductor package for supervised classification with high dimensional data. BMC Bioinformatics 9: 439

See Also

GeneSelection, tune, evaluation, compBoostCMA, dldaCMA, ElasticNetCMA, fdaCMA, flexdaCMA, gbmCMA, knnCMA, ldaCMA, LassoCMA, nnetCMA, pknnCMA, plrCMA, pls_ldaCMA, pls_lrCMA, pls_rfCMA, pnnCMA, qdaCMA, rfCMA, scdaCMA, shrinkldaCMA, svmCMAclassification

Examples

Run this code
### a simple k-nearest neighbour example
### datasets
## Not run: plot(x)
# data(golub)
# golubY <- golub[,1]
# golubX <- as.matrix(golub[,-1])
# ###Splitting data into training and test set
# X.tr<-golubX[1:30]
# X.new<-golubX[31:39]
# y.tr<-golubY[1:30]
# ### 1. GeneSelection
# selttest <- GeneSelection(X=X.tr, y=y.tr, method = "t.test")
# ### 2. tuning
# tunek <- tune(X.tr, y.tr, genesel = selttest, nbgene = 20, classifier = knnCMA)
# ### 3. classification
# pred <- prediction(X.tr=X.tr,y.tr=y.tr,X.new=X.new, genesel = selttest,
#                        tuneres = tunek, nbgene = 20, classifier = knnCMA)
# ### show and analyze results:
# show(pred)
# 
# ## End(Not run)

Run the code above in your browser using DataLab