ggplot_convergence: Plot loss curve

View source: R/function_plotConvergence.R

ggplot_convergenceR Documentation

Plot loss curve

Description

The "ggplot_convergence" function uses ggplot2 and reshape2 to visualize the decrease of the loss-function after a model has been trained.

Usage

ggplot_convergence(
  DTD.model,
  X.matrix = NA,
  test.data = NULL,
  estimate.c.type = "decide.on.model",
  title = ""
)

Arguments

DTD.model

either a numeric vector with length of nrow(X), or a list returned by train_deconvolution_model, DTD_cv_lambda_cxx, or descent_generalized_fista.

X.matrix

numeric matrix, with features/genes as rows, and cell types as column. Each column of X.matrix is a reference expression profile. A trained DTD model includes X.matrix, it has been trained on. Therefore, X.matrix should only be set, if the 'DTD.model' is not a DTD model.

test.data

list, with two entries, a numeric matrix each, named 'mixtures' and 'quantities' For examples see mix_samples, mix_samples_with_jitter or the package vignette 'browseVignettes("DTD")'.

estimate.c.type

string, either "non_negative", or "direct". Indicates how the algorithm finds the solution of arg min_C ||diag(g)(Y - XC)||_2.

  • If 'estimate.c.type' is set to "direct", there is no regularization (see estimate_c),

  • if 'estimate.c.type' is set to "non_negative", the estimates "C" must not be negative (non-negative least squares) (see (see estimate_nn_c))

title

string, additionally title

Details

As input parameter it needs the output of train_deconvolution_model, an DTD cross validation object, or the output of an FISTA optimization run. If the ‘DTD.model' includes a ’History' entry, and a 'test.data' is available the loss function can be evaluated for each intermediate steps of the optimization. Then, the resulting picture includes two convergence paths, one for the training data, and one for the test.data.
For an example see section "Visualization of learn curve" in the package vignette 'browseVignettes("DTD")'

Value

ggplot object


MarianSchoen/DTD documentation built on April 29, 2022, 1:59 p.m.