FindNumFactors: Determines the optimal number of NMF factors to use by...

View source: R/nmf.R

FindNumFactorsR Documentation

Determines the optimal number of NMF factors to use by comparing the reduction in reconstruction error vs the reduction in reconstruction error for a randomized matrix. The optimal number of factors is where the decrease in reconstruction errors intersect

Description

Adapted from Frigyesi et al, 2008. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2623306/

Usage

FindNumFactors(
  A,
  k.range = seq(2, 12, 2),
  n.cores = 1,
  do.plot = T,
  seed = NULL,
  loss = "mse",
  max.iter = 250
)

Arguments

A

Input data matrix

k.range

Range of NMF factors to fit over

n.cores

Number of threads

do.plot

Whether to plot the reconstruction error

seed

Random seed for randomizing matrix

loss

Loss function to use for NMF

max.iter

Maximum iterations for NMF run

Value

Reconstruction error at each number of NMF factors specified in k.range


yanwu2014/swne documentation built on Aug. 5, 2023, 4:42 a.m.