Learn R Programming

ClassifyR (version 1.2.4)

selectionPlot: Plot Pair-wise Overlap of Selected Features

Description

The average pair-wise overlap is computed for every pair of cross-validations. The overlap is converted to a percentage and plotted as a set of boxplots.

Usage

"selectionPlot"(results, comparison = c("within", "classificationName", "validation", "datasetName"), xVariable = c("classificationName", "datasetName", "validation"), boxFillColouring = c("classificationName", "datasetName", "validation", "None"), boxFillColours = NULL, boxLineColouring = c("validation", "classificationName", "datasetName", "None"), boxLineColours = NULL, rowVariable = c("None", "validation", "datasetName", "classificationName"), columnVariable = c("datasetName", "classificationName", "validation", "None"), yMax = 100, fontSizes = c(24, 16, 12, 16), title = "Feature Selection Stability", xLabel = "Analysis", yLabel = "Average Pairwise Common Features (%)", margin = grid::unit(c(0, 1, 1, 0), "lines"), rotate90 = FALSE, plot = TRUE, parallelParams = bpparam())

Arguments

results
A list of ClassifyResult objects.
comparison
The aspect of the experimental design to compare. See Details section for a detailed description.
xVariable
The factor to make separate boxes in the boxplot for.
boxFillColouring
A factor to colour the boxes by.
boxFillColours
A vector of colours, one for each level of boxFillColouring. If NULL, a default palette is used.
boxLineColouring
A factor to colour the box lines by.
boxLineColours
A vector of colours, one for each level of boxLineColouring. If NULL, a default palette is used.
rowVariable
The slot name that different levels of are plotted as separate rows of boxplots.
columnVariable
The slot name that different levels of are plotted as separate columns of boxplots.
yMax
The maximum value of the percentage to plot.
fontSizes
A vector of length 4. The first number is the size of the title. The second number is the size of the axes titles. The third number is the size of the axes values. The fourth number is the font size of the titles of grouped plots, if any are produced. In other words, when rowVariable or columnVariable are not NULL.
title
An overall title for the plot.
xLabel
Label to be used for the x-axis.
yLabel
Label to be used for the y-axis of overlap percentages.
margin
The margin to have around the plot.
rotate90
Logical. IF TRUE, the boxplot is horizontal.
plot
Logical. IF TRUE, a plot is produced on the current graphics device.
parallelParams
An object of class MulticoreParam or SnowParam.

Value

An object of class ggplot and a plot on the current graphics device, if plot is TRUE.

Details

Possible values for slot names are "datasetName", "classificationName", and "validation". If "None", then that graphic element is not used. Calculating all pair-wise set overlaps can be time-consuming. This stage can be done on multiple CPUs by providing the relevant options to parallelParams.

Examples

Run this code
  predicted <- data.frame(sample = sample(10, 100, replace = TRUE),
                          label = rep(c("Healthy", "Cancer"), each = 50))
  actual <- factor(rep(c("Healthy", "Cancer"), each = 5))
  result1 <- ClassifyResult("Example", "Differential Expression", LETTERS[1:10], LETTERS[10:1], list(1:100, c(1:9, 11:101)), list(c(1:3), c(2, 5, 6), c(1:4), c(5:8), 1:5),
                            list(predicted), actual, list("fold", 100, 5))
  predicted[, "label"] <- sample(predicted[, "label"])
  result2 <- ClassifyResult("Example", "Differential Variability", LETTERS[1:10], LETTERS[10:1], list(1:100, c(1:5, 11:105)), list(c(1:3), c(4:6), c(1, 6, 7, 9), c(5:8), c(1, 5, 10)),
                            list(predicted), actual, validation = list("leave", 1))
  # selectionPlot(list(result1, result2), xVariable = "classificationName", xLabel = "Analysis", columnVariable = "None", rowVariable = "None", boxFillColouring = "classificationName") # Wait for namespace problems to be fixed.

Run the code above in your browser using DataLab