mS3faFit: Fit MS3FA to data via EM/MS3FA

Description Usage Arguments Value Examples

View source: R/mS3faFit.R

Description

Fit MS3FA to data via EM/MS3FA

Usage

1
2
3
mS3faFit(trainInput, trainOutput, params, type = "fa",
  lambdaRidge = lambdaRidge, epsilon = 1e-10, maxIterations = 100,
  stopType = "parameter", turboEmMethods = NULL)

Arguments

trainInput

train input data; can contain NAs; error if a full row (input+output) is NA

trainOutput

train output data; can contain NAs; error if a full row (input+output) is NA

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

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/MS3FA, i.e. a list containing nDimX, nDimZ, type, mu_z_t, Sigma_z_t, 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
houseCopy <- house
houseCopy[1:10,2:3] <- NA
houseCopy[11:20,1] <- NA
params0 <- mS3faInit(trainInput=houseCopy[,2:3,drop=FALSE],
                     trainOutput=houseCopy[,1,drop=FALSE],
                     type="fa")
params <- mS3faFit(trainInput=houseCopy[,2:3,drop=FALSE],
                   trainOutput=houseCopy[,1,drop=FALSE],
                   params=params0,
                   type="fa",
                   lambdaRidge=0,
                   epsilon=1e-10,
                   maxIterations=100,
                   stopType="parameter",
                   turboEmMethods=c("em","pem"))
params <- mS3faFit(trainInput=houseCopy[,2:3,drop=FALSE],
                   trainOutput=houseCopy[,1,drop=FALSE],
                   params=NULL,
                   type="ppca",
                   lambdaRidge=0,
                   epsilon=1e-10,
                   maxIterations=100,
                   stopType="objfn",
                   turboEmMethods=NULL)

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