predict.classifierOutput {MLInterfaces} | R Documentation |
classifierOutput
objects
This function predicts values based on models trained with
MLInterfaces' MLearn
interface to many machine learning
algorithms.
## S3 method for class 'classifierOutput' predict(object, newdata, ...)
object |
An instance of class |
newdata |
An object containing the new input data: either a |
... |
Other arguments to be passed to the algorithm-specific predict methods. |
This S3 method will extract the ML model from the
classifierOutput
instance and call either a
generic predict method or, if available, a specficly written wrapper
to do classes prediction and class probabilities.
Currently, a list with
testPredictions |
A factor with class predictions. |
testScores |
A |
The function output will most likely be updated in a near future to a
classifierOutput
(or similar) object.
Laurent Gatto <lg390@cam.ac.uk>
MLearn
and classifierOutput
.
## Not run: set.seed(1234) data(sample.ExpressionSet) trainInd <- 1:16 clout.svm <- MLearn(type~., sample.ExpressionSet[100:250,], svmI, trainInd) predict(clout.svm, sample.ExpressionSet[100:250,-trainInd]) clout.ksvm <- MLearn(type~., sample.ExpressionSet[100:250,], ksvmI, trainInd) predict(clout.ksvm, sample.ExpressionSet[100:250,-trainInd]) clout.nnet <- MLearn(type~., sample.ExpressionSet[100:250,], nnetI, trainInd, size=3, decay=.01 ) predict(clout.nnet, sample.ExpressionSet[100:250,-trainInd]) clout.knn <- MLearn(type~., sample.ExpressionSet[100:250,], knnI(k=3), trainInd) predict(clout.knn, sample.ExpressionSet[100:250,-trainInd],k=1) predict(clout.knn, sample.ExpressionSet[100:250,-trainInd],k=3) #clout.plsda <- MLearn(type~., sample.ExpressionSet[100:250,], plsdaI, trainInd) #predict(clout.plsda, sample.ExpressionSet[100:250,-trainInd]) clout.nb <- MLearn(type~., sample.ExpressionSet[100:250,], naiveBayesI, trainInd) predict(clout.nb, sample.ExpressionSet[100:250,-trainInd]) # this can fail if training set does not yield sufficient diversity in response vector; # setting seed seems to help with this example, but other applications may have problems # clout.rf <- MLearn(type~., sample.ExpressionSet[100:250,], randomForestI, trainInd) predict(clout.rf, sample.ExpressionSet[100:250,-trainInd]) ## End(Not run) # end of dontrun