plot: Plot Method for the 'nblda' and 'nblda_trained' Classes

Description Usage Arguments Value Author(s) See Also Examples

Description

This function is used to generate model performance plots using ggplot2 functions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## S3 method for class 'nblda'
plot(x, y, ..., theme = c("nblda", "default"),
  metric = c("accuracy", "error", "sparsity"), return = c("plot", "aes"))

## S3 method for class 'nblda_trained'
plot(x, y, ..., theme = c("nblda", "default"),
  metric = c("accuracy", "error", "sparsity"), return = c("plot", "aes"))

## S4 method for signature 'nblda'
plot(x, y, ..., theme = c("nblda", "default"),
  metric = c("accuracy", "error", "sparsity"), return = c("plot", "aes"))

## S4 method for signature 'nblda_trained'
plot(x, y, ..., theme = c("nblda", "default"),
  metric = c("accuracy", "error", "sparsity"), return = c("plot", "aes"))

Arguments

x

a nblda object returned from trainNBLDA or nblda_trained object returned from nbldaTrained.

y

same as x and not required to be defined. If x is missing or NULL, nblda or nblda_trained object is imported from y.

...

further arguments to be passed to plotting function ggplot.

theme

pre-defined plot themes. It can be defined outside plot function using ggplot's library. See examples.

metric

which metric should be used in y-axis?

return

should complete plot or a ggplot object from ggplot be returned? One may select "aes" in order to add plot layers to returned ggplot aesthetics. See examples.

Value

A list of class ggplot.

Author(s)

Dincer Goksuluk

See Also

ggplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
set.seed(2128)
counts <- generateCountData(n = 20, p = 10, K = 2, param = 1, sdsignal = 0.5,
                            DE = 0.8, allZero.rm = FALSE, tag.samples = TRUE)
x <- t(counts$x + 1)
y <- counts$y
xte <- t(counts$xte + 1)
ctrl <- nbldaControl(folds = 2, repeats = 2)

fit <- trainNBLDA(x = x, y = y, type = "mle", tuneLength = 10,
                  metric = "accuracy", train.control = ctrl)

plot(fit)

# Use pre-defined theme
plot(fit, theme = "nblda")

# Externally defining plot theme
plot(fit, theme = "default") + theme_dark(base_size = 14)

# Return empty ggplot object and add layers.
plot(fit, theme = "nblda", return = "aes") +
  geom_point() + geom_line(linetype = 2)

NBLDA documentation built on May 2, 2019, 12:21 p.m.