plot {NBLDA}R Documentation

Plot Method for the nblda and nblda_trained Classes

Description

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

Usage

## 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 the trainNBLDA or nblda_trained object returned from the 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 the ggplot's library. See examples.

metric

which metric should be used in the y-axis?

return

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

Value

A list of class ggplot.

Author(s)

Dincer Goksuluk

See Also

ggplot

Examples

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)


[Package NBLDA version 1.0.1 Index]