faFit: Fit FA to data via EM/FA

Description Usage Arguments Value Examples

View source: R/faFit.R

Description

Fit FA to data via EM/FA

Usage

1
2
3
4
faFit(X_t_unsupervised, paramsNULL_nDimZ, params = NULL, type = "fa",
  lambdaRidge = 0, checkArgs = TRUE, checkPositiveDefinite = FALSE,
  epsilon = 1e-10, maxIterations = 100, stopType = "parameter",
  turboEmMethods = NULL)

Arguments

X_t_unsupervised

train input data as design matrix (must be matrix, not data.frame), i.e. row = instance, column = feature/attribute

paramsNULL_nDimZ

how many latent factors to consider; taken into consideration iff params is null

params

initialization parameters; can be NULL if no parameters are to be provided; check fitFaInit function if you want to set this

type

"unconstrained", "fa", or "ppca"; refers to psi

lambdaRidge

L2 regularization term; must be a number

checkArgs

whether to check the arguments are valid; it takes more time to execute

checkPositiveDefinite

whether to check the covariance matrices are valid; it takes more time to execute

epsilon

tolerance parameter regarding iteration stop; the stop criterion is something like this: if |old-new|/|old| < epsilon then STOP, where old, new are loglikelihoods (|a| is module) or parameters (|a| is L2 norm squared); this last part is controlled via "stopType" parameter

maxIterations

maximum number of iterations

stopType

"parameter" or "objfn"

turboEmMethods

if it is NULL, then a plot of log-likelihoods is provided; if it is not NULL, it must be a vector of methods accepted in the 'turboEM' package, e.g. c("em","squarem","pem"), and, in this case, the parameters corresponding to the first method in turboEmMethods are returned; additional information may be printed

Value

final parameters learnt by EM/FA, i.e. a list containing nDimX, nDimZ, type, mu_t, lambda_t, psi_t. "_t" comes from "transpose"

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
params <- faFit(X_t_unsupervised = house[,-1,drop=FALSE],
paramsNULL_nDimZ = 1,
             params=NULL,
             type="fa",
             lambdaRidge=0,
             checkArgs=FALSE,
             checkPositiveDefinite=FALSE,
             epsilon=1e-10,
             maxIterations=100,
             stopType="objfn",
             turboEmMethods=NULL)
params

params0 <- faInit(X_t_unsupervised = house[,-1,drop=FALSE],
               nDimZ=1,
               type = "fa",
               checkArgs = TRUE)
params <- faFit(X_t_unsupervised = house[,-1,drop=FALSE],
             paramsNULL_nDimZ = NULL,
             params=params0,
             type="fa",
             lambdaRidge=0,
             checkArgs=FALSE,
             checkPositiveDefinite=FALSE,
             epsilon=1e-10,
             maxIterations=100,
             stopType="parameter",
             turboEmMethods=c("em","pem"))
params

aciobanusebi/s2fa documentation built on Aug. 7, 2021, 6:38 a.m.