sgdgmf.cv.step: Single step of cross-validation for generalized matrix...

sgdgmf.cv.stepR Documentation

Single step of cross-validation for generalized matrix factorization models

Description

Internal function running a single step of cross-validation for generalized matrix factorization (GMF) models and calculating some goodness-of-fit measures on the train and test sets.

Usage

sgdgmf.cv.step(
  train,
  test,
  X,
  Z,
  family,
  ncomp,
  maxcomp,
  fold,
  nfolds,
  weights,
  offset,
  method,
  sampling,
  penalty,
  control.init,
  control.alg,
  control.cv
)

Arguments

train

train-set matrix of responses (n \times m)

test

test-set matrix of responses (n \times m)

X

matrix of row fixed effects (n \times p)

Z

matrix of column fixed effects (q \times m)

family

a glm family (see family for more details)

ncomp

ranks of the latent matrix factorization used in cross-validation (default 1 to 10)

maxcomp

maximum rank allowed in the cross-validation exploration

fold

integer number identifying the current fold

nfolds

maximum number of folds in the cross-validation

weights

an optional matrix of weights (n \times m)

offset

an optional matrix of offset values (n \times m), that specify a known component to be included in the linear predictor.

method

estimation method to minimize the negative penalized log-likelihood

sampling

sub-sampling strategy to use if method = "sgd"

penalty

list of penalty parameters (see set.penalty for more details)

control.init

list of control parameters for the initialization (see set.control.init for more details)

control.alg

list of control parameters for the optimization (see set.control.alg for more details)

control.cv

list of control parameters for the cross-validation (see set.control.cv for more details)

Value

Returns a data.frame containing the current number of latent factors in the model (ncomp), the fold identifier (fold), the degrees of freedom, i.e. the number of parameters, of the model (df), the AIC, BIC and deviance (respectively, aic, bic, dev) calculated on the train and test sets.


sgdGMF documentation built on April 3, 2025, 7:37 p.m.