Last data update: 2014.03.03

R: Container for Storing Classification Results
ClassifyResultR Documentation

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.

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.

Author(s)

Dario Strbenac

Examples

  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)
  }

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(ClassifyR)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: BiocParallel
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/ClassifyR/ClassifyResult-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ClassifyResult
> ### Title: Container for Storing Classification Results
> ### Aliases: ClassifyResult ClassifyResult-class
> ###   ClassifyResult,character,character,character,character,character-method
> ###   show,ClassifyResult-method predictions
> ###   predictions,ClassifyResult-method actualClasses
> ###   actualClasses,ClassifyResult-method features
> ###   features,ClassifyResult-method performance
> ###   performance,ClassifyResult-method tunedParameters
> ###   tunedParameters,ClassifyResult-method totalPredictions
> ###   totalPredictions,ClassifyResult-method
> 
> ### ** Examples
> 
>   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)
+   }
Loading required package: curatedOvarianData
Loading required package: affy
Loading required package: sparsediscrim
An object of class 'ClassifyResult'.
Dataset Name: Ovarian Cancer.
Classification Name: Differential Expression.
Feature Selection Name: Limma moderated t-test.
Features: List of length 2 of lists of length 2 of row indices.
Validation: 2 fold cross-validation of 2 resamples.
Predictions: List of data frames of length 2.
Performance Measures: None calculated yet.
 [1] Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor
[16] Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor
[31] Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor Poor
[46] Poor Poor Poor Good Good Good Good Good Good Good Good Good Good Good Good
[61] Good Good Good Good Good Good Good Good Good Good Good Good Good Good Good
[76] Good Good Good Good Good Good Good Good Good Good Good Good Good Good Good
[91] Good
Levels: Good Poor
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>