msc.classifier.test {caMassClass} | R Documentation |
Test classifier through cross-validation. Common interface for cross-validation of several standard classifiers. Includes feature selection and feature scaling steps. Allows to specify that some test samples are multiple copies of the same sample, and should return the same label.
msc.classifier.test( X, Y, iters=50, SplitRatio=2/3, verbose=FALSE, RemCorrCol=0, KeepCol=0, prior=1, same.sample=NULL, ScaleType=c("none", "min-max", "avr-std", "med-mad"), method=c("svm", "nnet", "lda", "qda", "LogitBoost", "rpart"), ...)
X |
A matrix or data frame with training/testing data. Rows contain samples and columns contain features/variables |
Y |
Class labels for the training data samples.
A response vector with one label for each row/component of x .
Can be either a factor, string or a numeric vector. Labels with 'NA' value
signify test data-set. |
iters |
Number of iterations. Each iteration consist of splitting the data into train and test sets, performing the classification and storing results |
SplitRatio |
Splitting ratio used to divide available data during
cross-validation:
|
RemCorrCol |
See msc.classifier.run . |
KeepCol |
See msc.classifier.run . |
ScaleType |
See msc.classifier.run . |
prior |
See msc.classifier.run . |
same.sample |
See msc.classifier.run . |
method |
See msc.classifier.run . |
verbose |
boolean flag turns debugging printouts on. |
... |
Additional parameters to be passed to classifiers. See
method for suggestions. |
This function follows standard cross-validation steps:
Y
are used to divide data X
into train
set (with
known labels) and test set (labels set to NA
and will be calculated)
sample.split
function from caTools package.
msc.classifier.run
function
Y |
Predicted class labels. If there were any unknown samples in input
data, marked by NA 's in input Y , than output Y will
only hold prediction of those samples, otherwise prediction will be made
for all samples. |
Res |
Holds fraction of correct prediction during cross-validation for
each iteration. mean(Res) will give you average accuracy. |
Tabl |
Contingency table of predictions shows all the input label compared to output labels |
Jarek Tuszynski (SAIC) jaroslaw.w.tuszynski@saic.com
msc.preprocess.run
and/or msc.project.run
functions.
sample.split
,
msc.classifier.run
, msc.features.select
and msc.features.scale
functions.
tune
function from e1071 package.
svm
,
nnet
, LogitBoost
, lda
,
qda
, rpart
data(iris) A = msc.classifier.test(iris[,-5],iris[,5], method="LogitBoost", nIter=2) print(A) cat("correct classification in",100*mean(A$Res),"+-",100*sd(A$Res),"percent of cases\n") stopifnot( mean(A$Res)<89 )