s3faFit: Fit S3FA to data via EM/S3FA

Description Usage Arguments Value Examples

View source: R/s3faFit.R

Description

Fit S3FA to data via EM/S3FA

Usage

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

Arguments

X_t_supervised

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

Z_t_supervised

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

X_t_unsupervised

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

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/S3FA, 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
25
26
27
28
29
30
31
32
params0 <- s3faInit(X_t_supervised = house[1:10,2:3,drop=FALSE],
                    Z_t_supervised = house[1:10,1,drop=FALSE],
                    X_t_unsupervised = house[11:20,2:3,drop=FALSE],
                    type = "fa",
                    checkArgs = TRUE)
params <- s3faFit(X_t_supervised = house[1:10,2:3,drop=FALSE],
                  Z_t_supervised = house[1:10,1,drop=FALSE],
                  X_t_unsupervised = house[11:20,2:3,drop=FALSE],
                  params=params0,
                  type="fa",
                  lambdaRidge=0,
                  checkArgs=FALSE,
                  checkPositiveDefinite=FALSE,
                  epsilon=1e-10,
                  maxIterations=100,
                  stopType="parameter",
                  turboEmMethods=c("em","pem"))
params

params <- s3faFit(X_t_supervised = house[1:10,2:3,drop=FALSE],
                  Z_t_supervised = house[1:10,1,drop=FALSE],
                  X_t_unsupervised = house[11:20,2:3,drop=FALSE],
                  params=NULL,
                  type="un",
                  lambdaRidge=0,
                  checkArgs=FALSE,
                  checkPositiveDefinite=FALSE,
                  epsilon=1e-10,
                  maxIterations=100,
                  stopType="objfn",
                  turboEmMethods=NULL)
params

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