##########################
## Classifier training
##########################
# Load an expressionSet:
library(leukemiasEset)
data(leukemiasEset)
# Select the train samples:
trainSamples<- c(1:10, 13:22, 25:34, 37:46, 49:58)
# summary(leukemiasEset$LeukemiaType[trainSamples])
# Train a classifier or load a trained one:
# leukemiasClassifier <- geNetClassifier(leukemiasEset[,trainSamples],
# sampleLabels="LeukemiaType", plotsName="leukemiasClassifier")
data(leukemiasClassifier) # Sample trained classifier
##########################
## External Validation:
##########################
# Select the samples to query the classifier
# - External validation: samples not used for training
testSamples <- c(1:60)[-trainSamples]
# Make a query to the classifier:
queryResult <- queryGeNetClassifier(leukemiasClassifier, leukemiasEset[,testSamples])
# Create the confusion matrix
confMatrix <- table(leukemiasEset[,testSamples]$LeukemiaType,queryResult$class)
# Calculate its accuracy, call rate, sensitivity and specificity:
externalValidation.stats(confMatrix)
Run the code above in your browser using DataLab