fit_pois_glmnet_mmdcv: Fit POIS-glment with MMD cross-validation

Description Usage Arguments Details Value Examples

View source: R/estimate.R

Description

The function fits POIS-glment and applies cross-validation (CV) to choose an optimal regularization parameter.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
fit_pois_glmnet_mmdcv(
  z,
  r = max(z),
  train_ratio = 0.7,
  nlam = 12,
  lambda = 10^seq(-4, -1.3, length.out = nlam),
  nreps = 2,
  agg_func = mean,
  alpha = 1,
  use_parallel = F,
  ncores = 7,
  symmetrize = TRUE
)

Arguments

z

is a potentially sparse data array of dimensions: (sample size) x (data dimension)

r

maximum number of levels (K)'

train_ratio

train/validation split ratio will be train_ratio/(1-train_ratio).

nlam

number of regularization parameters (lambda) to use; ignored if lambda is provided.

lambda

the vector of regularization parameters to use.

nreps

the number of CV splits to average over.

agg_func

the aggregation function for the MMDs.

Details

The maximum mean discrepency (MMD) is used as the evaluation metric for CV. The MMD is computed between a sample from the original data and one from the fitted model. The MMD is computed for a sequence of Gaussian kernels with varying bandwidths, and aggregated using a user-supplied function.

Value

The lambda vector, the regularization curve, a list of fitted POIS models, the index of the optimal model and the optimal lambda

Examples

1
out = fit_pois_glmnet_mmdcv(amazon, lambda = 10^seq(-4,-1.3, length.out = 5))

aaamini/pois documentation built on Dec. 31, 2020, 6:37 p.m.