Learn R Programming

ClassifyR (version 1.6.2)

ClassifyResult: Container for Storing Classification Results

Description

Contains a table of actual sample classes and predicted classes, the indices of features selected for each fold of each bootstrap resampling or each hold-out classification, and error rates. This class is not intended to be created by the user, but could be used in another package. It is created by runTests.

Arguments

Constructor

ClassifyResult(datasetName, classificationName, originalNames, originalFeatures, rankedFeatures, chosenFeatures, predictions, actualClasses, validation, tune = list(NULL))
datasetName
A name associated with the dataset used.
classificationName
A name associated with the classification.
originalNames
Sample names.
originalFeatures
Feature names.
rankedFeatures
Indices or names of all features, from most to least important.
chosenFeatures
Indices or names of features selected at each fold.
predictions
A list of data.frame containing information about samples, their actual class and predicted class.
actualClasses
Factor of class of each sample.
validation
List with first elment being name of the validation scheme, and other elements providing details about scehme.
tune
A description of the tuning parameters, and the value chosen of each parameter.

Summary

A method which summarises the results is available. result is a ClassifyResult object.
show(result)Prints a short summary of what result contains.
totalPredictions(ClassifyResult)Calculates the sum of the number of predictions.

Accessors

result is a ClassifyResult object.
predictions(result)
Returns a list of data.frame. Each data.frame contains columns sample, predicted, and actual. For hold-out validation, only one data.frame is returned of all of the concatenated predictions.
actualClasses(result)
Returns a factor class labels, one for each sample.
features(result)
A list of the features selected for each training.
performance(result)
Returns a list of performance measures. This is empty until calcPerformance has been used.
tunedParameters(result)
Returns a list of tuned parameter values. If cross-validation is used, this list will be large, as it stores chosen values for every validation.
names(result)
Returns a character vector of sample names.

Examples

Run this code
  if(require(curatedOvarianData) && require(sparsediscrim))
  {
    data(TCGA_eset)
    badOutcome <- which(pData(TCGA_eset)[, "vital_status"] == "deceased" & pData(TCGA_eset)[, "days_to_death"] <= 365)
    goodOutcome <- which(pData(TCGA_eset)[, "vital_status"] == "living" & pData(TCGA_eset)[, "days_to_death"] >= 365 * 5)
    TCGA_eset <- TCGA_eset[, c(badOutcome, goodOutcome)]
    classes <- factor(rep(c("Poor", "Good"), c(length(badOutcome), length(goodOutcome))))
    pData(TCGA_eset)[, "class"] <- classes
    results <- runTests(TCGA_eset, "Ovarian Cancer", "Differential Expression", resamples = 2, folds = 2)
    show(results)
    predictions(results)
    actualClasses(results)
  }

Run the code above in your browser using DataLab