R/setupDiagnostics.R

Defines functions setupDiagnostics

Documented in setupDiagnostics

#' Setup a data.frame of diagnostics
#'
#' @param res the result from calling the C++ routine used to fit a model
#'   in owl
#'
#' @return A data.frame
#'
#' @keywords internal
setupDiagnostics <- function(res) {
  time <- res$time
  primals <- res$primals
  duals <- res$duals
  infeasibilities <- res$infeasibilities
  line_searches <- res$line_searches

  nl <- length(time)
  nn <- lengths(time)
  time <- unlist(time)
  primal <- unlist(primals)
  dual <- unlist(duals)
  infeasibility <- unlist(infeasibilities)
  line_searches <- unlist(line_searches)

  data.frame(iteration = unlist(lapply(nn, seq_len)),
             time = time,
             primal = primal,
             dual = dual,
             infeasibility = infeasibility,
             line_searches = line_searches,
             penalty = rep(seq_len(nl), nn))
}

Try the owl package in your browser

Any scripts or data that you put into this service are public.

owl documentation built on Feb. 11, 2020, 5:09 p.m.