Create a plot showing improvement in one or more Poisson NMF or multinomial topic model fits over time.

plot_progress(
  fits,
  x = c("timing", "iter"),
  y = c("loglik", "dev", "res"),
  add.point.every = 20,
  colors = c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7"),
  linetypes = "solid",
  linesizes = 0.5,
  shapes = 19,
  fills = "white",
  e = 0.01,
  theme = function() theme_cowplot(12)
)

Arguments

fits

An object of class "poisson_nmf_fit" or "multinom_topic_model_fit", or a non-empty, named list in which each all list elements are objects of class "poisson_nmf_fit" or all objects of class "multinom_topic_model_fit".

x

Choose "timing" to plot improvement in the solution over time, or choose "iter" to plot improvement in the solution per iteration.

y

Column of the "progress" data frame used to assess progress of the Poisson NMF optimization method(s). Should be one of "loglik" (Poisson NMF or multinomial topic model log-likelihood), "dev" (deviance) or "res" (maximum residual of KKT conditions). The deviance is only valid for Poisson NMF model fits.

add.point.every

A positive integer giving the iteration interval for drawing points on the progress curves. Set to Inf to prevent points from being drawn on the plot.

colors

Colours used to draw progress curves; passed as the values input to scale_color_manual. If fewer colours than "fits" are given, the colours are recycled.

linetypes

Line types used to draw progress curves; passed as the values input to scale_linetype_manual. If fewer line types than “fits” are given, the line types are recycled.

linesizes

Line sizes used to draw progress curves; passed as the values input to scale_size_manual. If fewer line sizes than “fits” are given, the line sizes are recycled.

shapes

Shapes used to draw points at the selected iterations; passed as the values input to scale_shape_manual. If fewer shapes than “fits” are given, the shapes are recycled.

fills

Fill colours used to draw points at the selected iterations; passed as the values input to scale_fill_manual. If fewer fill colours than “fits” are given, the fill colours are recycled.

e

A small, positive number added to the vertical axis (for y = "loglik" and y = "dev" only) so that the logarithmic scale does not over-emphasize very small differences.

theme

The ‘ggplot2’ “theme”.

Value

A ggplot object.

Details

The horizontal axis shows the recorded runtime (in s), and the vertical axis shows some quantity measuring the quality of the fit: the log-likelihood, deviance or maximum residual of the Karush-Kuhn-Tucker (KKT) first-order optimality conditions. To better visualize log-likelihoods and deviances, log-likelihood and deviance differences are shown on the logarithmic scale. Differences are calculated with respect to the best value achieved over all the fits compared.

Note that only minimal argument checking is performed.

See also