plot_grid {xnet}R Documentation

Plot the grid of a tuned tskrr model

Description

With this function, you can visualize the grid search for optimal lambdas from a tskrrTune object. In the case of two-dimensional grid search, this function plots a contour plot on a grid, based on the functions image and contour. For one-dimensional grid search, the function creates a single line plot.

Usage

plot_grid(
  x,
  addlambda = TRUE,
  lambdapars = list(col = "red"),
  log = TRUE,
  opts.contour = list(nlevels = 10),
  ...
)

Arguments

x

an object that inherits from tskrrTune

addlambda

a logical value indicating whether the lambda with the minimum loss should be added to the plot. In case of a one dimensional plot, this adds a colored vertical line. In the case of a two dimensional plot, this adds a colored point at the minimum.

lambdapars

a list with named par values passed to the function abline or points for plotting the best lambda value when addmin = TRUE.

log

a logical value indicating whether the lambdas should be plotted at a log scale (the default) or not.

opts.contour

options passed to the function contour for 2D grid plots. Ignored for 1D grid plots.

...

arguments passed to other functions. For a one dimensional plot, this will be the function plot

Value

NULL invisibly

Examples


data(drugtarget)

## One dimensional tuning
tuned1d <- tune(drugTargetInteraction, targetSim, drugSim,
                lim = c(1e-4,2), ngrid = 40,
                fun = loss_auc, onedim = TRUE)

plot_grid(tuned1d)
plot_grid(tuned1d, lambdapars = list(col = "green",
                                     lty = 1, lwd = 2),
          log = FALSE, las = 2, main = "1D tuning")

## Two dimensional tuning
tuned2d <- tune(drugTargetInteraction, targetSim, drugSim,
                lim = c(1e-4,10), ngrid = 20,
                fun = loss_auc)

plot_grid(tuned2d)


[Package xnet version 0.1.11 Index]