Learn R Programming

geNetClassifier (version 1.12.0)

externalValidation.stats: Statistics of the external validation.

Description

Taking as input the confussion matrix resulting from external validation calculates the global Accuracy, Call Rate, Sensitivity, Specificity and Matthews Correlation Coefficient.

Usage

externalValidation.stats(confussionMatrix, numDecimals = 2)

Arguments

confussionMatrix
Confussion matrix containing the real class as rows and the assigned class as columns.
numDecimals
Integer. Number of decimals to show on the statistics.

Value

List:
  • global General classifier stats. Accuracy: Percentage of correctly assigned samples within all assigned samples. CallRate: Percentage of samples wich were assigned to a class.
  • byClass Stats by class. Sensitivity: Percentage of samples of each class which were correctly identified (Rate of true positives) Specificity: Percentage of samples assigned to a given class that really belonged to the class (Rate of true negatives) MCC (Matthews Correlation Coefficient): Measure wich takes into account both, true and false positives and negatives. (100%: Perfect assignments) confMatrix Confussion matrix.

See Also

Main package function and classifier training: geNetClassifier Querying the classifier: queryGeNetClassifier Generating the probability matrix: externalValidation.probMatrix

Examples

Run this code
##########################
## 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