plot.sisal: Plotting Sequential Input Selection Results

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/plot.sisal.R

Description

A plot method for class "sisal". Supports 3 plot types: error as a function of the number of variables, search graph, and color key of the search graph.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## S3 method for class 'sisal'
plot(x, which = 1, standardize = "inherit", ...,
     plotArgs = list(list(), list(mai = rep(0.1, 4))),
     xlim = c(x[["d"]], 0), ylim = NULL, ask = TRUE,
     dev.set = !ask, draw.node.labels = TRUE,
     draw.edge.labels = TRUE, draw.selected.labels = TRUE,
     rankdir = c("TB", "LR", "BT", "RL"),
     fillcolor.normal = "deepskyblue",
     fillcolor.pruned = "deeppink",
     fillcolor.selected = "chartreuse",
     fillcolor.levelbest = "gold",
     fillcolor.small = "moccasin", fillcolor.large = "black",
     fillcolor.NA = "white",
     bordercolor.normal = "black",
     bordercolor.special.levelbest = fillcolor.levelbest,
     bordercolor.special.selected = fillcolor.selected,
     color.by.error = FALSE,
     ramp.space = c("Lab", "rgb"), ramp.size = 128,
     error.limits = c(NA_real_, NA_real_),
     category.labels =
         c(normal = gettext("Other", domain="R-sisal"),
           pruned = gettext("Pruned", domain="R-sisal"),
           levelbest = gettext("Best\nin class", domain="R-sisal"),
           selected = gettext("Selected", domain="R-sisal"),
           special.levelbest = gettext("Best\n(no branching)",
                                       domain="R-sisal"),
           special.selected = gettext("Selected\n(no branching)",
                                      domain="R-sisal"),
           shape.normal=gettext("Other", domain="R-sisal"),
           shape.highlighted=gettext("Highlighted", domain="R-sisal")),
     integrate.colorkey = TRUE, colorkey.gap = 0.1,
     colorkey.space = c("right", "bottom", "left", "top"),
     colorkey.title.gp = gpar(fontface = "bold"),
     nodesep = 0.25, ranksep = 0.5,
     graph.attributes = character(0),
     node.attributes = character(0),
     edge.attributes = character(0))

Arguments

x

an object of class "sisal".

which

which plots to draw. A numeric vector containing a subset of the following numbers:

1

error vs. number of inputs.

2

search graph. A directed acyclic graph (DAG).

3

node shape and color keys for the search graph. Requires that plot 2 is drawn, too.

The default is to draw plot number 1. For drawing plot number 2, Bioconductor packages "graph" and "Rgraphviz" must be installed.

Some other arguments of this method only apply to specific plots.

standardize

"inherit" or a logical flag. If TRUE, the error values in plot 1 correspond to standardized data (see standardize in sisal). If FALSE, the original scale of the data is used instead. If "inherit" (the default), the value of this argument is copied from x.

...

arguments passed to plot and matplot. These are used in all plots where plot or matplot do the actual drawing. For more fine-grained control and passing arguments to other graphical functions, use the plotArgs argument.

plotArgs

arguments passed to graphical functions. A list where plotArgs[[k]] (if present) are named lists of arguments passed to plot number k. See ‘Details’.

xlim

the x limits c(x1, x2) of plot 1. A numeric vector. Defaults to showing the whole range, i.e. everything between no input variables at all (except possibly an intercept) and the maximum number of inputs.

ylim

the y limits c(x1, x2) of plot 1. A numeric vector. If NULL (the default), adjusts to the range of y values corresponding to x values delimited by xlim.

ask

a logical flag. If TRUE (the default) and !dev.set, prompts the user before replacing a plot drawn with this function with another one. The user will not be alerted as long as there are free slots in the plot layout (see mfrow and mfcol in par).

dev.set

a logical flag. If TRUE, the function calls dev.set for switching to the next available graphical device when it runs out of free slots in the plot layout. If FALSE, the same graphical device is used for all the plots. The default value is !ask.

draw.node.labels

a logical flag. If TRUE, label the nodes of the search graph plot representing one input variable.

draw.edge.labels

a logical flag. If TRUE, label the edges of the search graph plot with the identity of the removed input variable.

draw.selected.labels

a logical flag. If TRUE, label the nodes of the search graph plot representing the L.v and L.f input variable sets of sisal.

rankdir

the drawing direction of plot number 2 (search graph). A character string, one of "TB" (top to bottom, the default), "LR" (left to right), "BT" (bottom to top), or "RL" (right to left).

fillcolor.normal

fill color for normal nodes in plot number 2.

fillcolor.pruned

fill color for pruned (unevaluated) nodes in plot 2. If color.by.error is TRUE, this color is used as the border color.

fillcolor.selected

fill color for nodes representing the L.v and L.f input variable sets of sisal in plot 2. If color.by.error is TRUE, this color is used as the border color.

fillcolor.levelbest

fill color for nodes with the smallest validation error using a given number of input variables in plot 2. If color.by.error is TRUE, this color is used as the border color.

fillcolor.small

if color.by.error is TRUE, fill color for nodes with small validation error in plot 2.

fillcolor.large

if color.by.error is TRUE, fill color for nodes with large validation error in plot 2.

fillcolor.NA

if color.by.error is TRUE, fill color for pruned (unevaluated) nodes in plot 2.

bordercolor.normal

border color for normal nodes in plot 2.

bordercolor.special.levelbest

border color for special nodes in plot 2. If branching (hbranches > 1) reduces validation error with a given number of input variables, the “no branching” node is marked with this border color. If pruning.keep.best is FALSE, the comparison may not be possible for all sizes of the input variable set.

bordercolor.special.selected

border color for another kind of special nodes in plot 2. The “no branching” L.v or L.f node, if different from the corresponding node in the solution where branching is allowed, is marked with this border color. If pruning.keep.best is FALSE, these alternative L.v and L.f nodes may not be defined, in which case the special color will not be used. If color.by.error is TRUE, this border color is also used to mark nodes that would be marked with fillcolor.selected in the case where color.by.error is FALSE.

color.by.error

a logical flag. If TRUE nodes in plot 2 are colored using a color gradient between fillcolor.small and fillcolor.large according to the validation error in the node. If FALSE, the nodes are colored by category (normal, pruned, selected, levelbest).

ramp.space

color space to be used in plots number 2 and 3 if color.by.error is TRUE. Either "Lab" (the default) or "rgb". See colorRamp.

ramp.size

the number of colors to be used in the color gradient of plot number 3 if color.by.error is TRUE. See colorRampPalette.

error.limits

a numeric vector giving the minimum (first value) and maximum (second value) validation error. These are used as the endpoints of the color gradient used in plots number 2 and 3 if color.by.error is TRUE.

category.labels

text labels to be used in plot number 3 if color.by.error is FALSE. A character vector with elements named "normal", "pruned", "levelbest" and "selected". See the corresponding arguments with the name prefix "fillcolor". The vector must also have elements named "special.levelbest" and "special.selected". See the corresponding arguments with the name prefix "bordercolor". The final required elements are "shape.normal" and "shape.highlighted", which correspond to rectangular and circular nodes, respectively. Circular shape highlights nodes that have the lowest validation error considering the number of inputs used. Also highlighted is each node with the lowest validation error per number of variables but without using branches, if available and different from the unrestricted best node.

integrate.colorkey

a logical flag. If TRUE, plots 2 (graph) and 3 (color and shape key for the graph) will be integrated if possible. This involves a version requirement on the "Rgraphviz" package. If FALSE or the version requirement is not met, the plots will be drawn separately.

colorkey.gap

a numeric value giving the space (in inches) between the graph and the color key when plot 2 and 3 are integrated (integrate.colorkey).

colorkey.space

location of the color and shape key (plot 3) relative to the graph (plot 2). One of "bottom", "right", "top" and "left".

colorkey.title.gp

graphical parameters for the titles in plot 3. See gpar.

nodesep

a Graphviz attribute giving the minimum space in inches between adjacent nodes representing the same number of input variables. This numeric value applies to plot number 2.

ranksep

a Graphviz attribute giving the minimum space in inches between adjacent rows or columns of nodes, where a row or column consists of nodes representing the same number of input variables. This numeric value applies to plot number 2.

graph.attributes

a named character vector of extra Graphviz graph attributes. Applies to plot number 2.

node.attributes

a named character vector of extra Graphviz node attributes. Applies to plot number 2.

edge.attributes

a named character vector of extra Graphviz edge attributes. Applies to plot number 2.

Details

In argument plotArgs, plotArgs[[1]] is passed to matplot, plotArgs[[2]] to the plot method for class "Ragraph", and plotArgs[[3]] to draw.colorkey$key.

For possible color values, see col2rgb.

Value

When 2 %in% which, the function invisibly returns a graph of class "graphNEL" representing the search graph of a run of sisal. Otherwise NULL.

Author(s)

Mikko Korpela

References

For information about graph, node and edge attributes for plot number 2, see the Graphviz web site: http://www.graphviz.org/.

See Also

sisal

Examples

1
2
3
4
5
6
7
8
9
library(graphics)
foo <- testSisal(dataset="toy", Mtimes=10)
## Plotting the search graph requires "Rgraphviz" and "graph"
if (requireNamespace("Rgraphviz", quietly=TRUE) &&
    requireNamespace("graph", quietly=TRUE)) {
    plot(foo, which=2)
}
## Default output is a mean squared error plot
plot(foo)

sisal documentation built on May 29, 2017, 9:09 a.m.