Description Usage Arguments Details Value Note Author(s) See Also Examples
View source: R/methods-classifierOutput.R
This function predicts values based on models trained with
MLInterfaces' MLearn
interface to many machine learning
algorithms.
1 2 |
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
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ## 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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.