parafac_conv: Calculate a PARAFAC model similar to and using 'parafac'.

View source: R/parafac_functions.R

parafac_convR Documentation

Calculate a PARAFAC model similar to and using parafac.

Description

Please refer to parafac for input parameters and details. This wrapper function ensures 'nstart' converging models are calculated. On the contrary, parafac calculates 'nstart' models regardless if they are converging.

Usage

parafac_conv(
  X,
  nstart,
  verbose = FALSE,
  output = c("best", "all"),
  cl = NULL,
  ...
)

Arguments

X

array

nstart

number of converging models to calculate

verbose

logical, whether more information is supplied

output

Output the best solution (default) or output all nstart solutions.

cl

cluster to be used for parallel processing

...

arguments passed on to parafac

Value

either a parafac model or a list of parafac models

See Also

parafac

Examples


data(eem_list)

dim_min <- 3 # minimum number of components
dim_max <- 4 # maximum number of components
nstart <- 25 # random starts for PARAFAC analysis, models built simulanuously, best selected
# cores <- parallel::detectCores(logical=FALSE) # use all cores but do not use all threads
cores <- 2 # package checks only run with 2 cores
maxit = 2500
ctol <- 10^-7 # tolerance for parafac

pfres_comps <- eem_parafac(eem_list, comps = seq(dim_min, dim_max),
    normalise = TRUE, strictly_converging = TRUE, maxit = maxit, nstart = nstart,
    ctol = ctol, cores = cores)

# keep all calculated models for diagnostics
pfres_comps_all <- eem_parafac(eem_list, comps = seq(dim_min, dim_max),
    normalise = TRUE, strictly_converging = TRUE, output = "all", maxit = maxit,
    nstart = nstart, ctol = ctol, cores = cores)



staRdom documentation built on July 9, 2023, 5:57 p.m.