EMglmnet: Penalized Mixtures of Experts

Description Usage Arguments Value

Description

Fits a penalized mixture of experts model using the EM algorithm. In the EM steps penalized logistic models are fitted using function glmnet from glmnet is used.

Usage

1
2
3
4
5
6
EMglmnet(y, X, colsGating = 1:ncol(X), colsExperts = 1:ncol(X), J = 2,
  lambda, alpha = 1, standardize = FALSE,
  type.multinomial = c("ungrouped", "grouped"), calculate.path = TRUE,
  interceptGating = TRUE, interceptExperts = TRUE, offsetGating = NULL,
  offsetExperts = NULL, iter.max = 100, tol = 1e-06,
  init.weights = NULL, minprior = 0.05, sd.tol = 1e-04)

Arguments

y

A factor specifying the class membership for each observation.

X

A matrix or data.frame or Matrix containing the explanatory variables (must not contain an intercept column).

colsGating

Names or indices of columns in X to be used for the gating model. Default is all columns.

colsExperts

Names or indices of columns in X to be used for the expert models. Default is all columns.

J

The number of experts / mixture components. Defaults to 2.

lambda

Penalty parameter. Can be a scalar or a vector of length J+1 with different components for the J experts and the gating model. All components must be >= 0.

alpha

Mixing parameter for the elastic net penalty. Can be a scalar or a vector of length J+1 with different components for the J experts and the gating model. All components must be in [0,1]. Defaults to 1.

standardize

Logical. Should the columns of X be standardized prior to fitting the model?

type.multinomial

If "grouped" and the number of mixture components J and/or the number of classes is larger than two, a group Lasso penalty will be used on the multinomial coefficients for a variable. Defaults to "ungrouped".

calculate.path

Logical. Should paths for the gating and expert models be calculated after the EM algorithm terminated? These are based on the weights calculated in the last E step.

interceptGating

Logical. Does the gating model include an intercept? Defaults to TRUE.

interceptExperts

Logical. Does the expert model include an intercept? Defaults to TRUE.

offsetGating

Offset term for the gating model.

offsetExperts

Offset term for the expert model.

iter.max

Maximum number of EM iterations.

tol

Small positive value to detect convergence of the EM algorithm.

init.weights

An nrow(X) times J matrix containing initial group membership values for the EM algorithm. The row sums must be 1. Defaults to NULL, which means that initial weights will be obtained by random segmentation.

minprior

Minimal relative size of experts. Defaults to 0.05. Experts which are smaller are removed.

sd.tol

Tolerance for detecting constant gating models, i.e., gating models not depending on the inputs and thus making constant predictions.

Value

An object of class EMglmnet. A list with entries:

gating

The gating model. An object of class glmnet.

experts

A list of J expert models. These are objects of class glmnet.

weights

The final group membership values.

iters

The number of iterations in the EM algorithm.

J,K, colsGating, colsExperts, lambda, offsetGating, offsetExperts

See arguments.

lev1

Class labels present in the data.

lev

Class labels.

gatingPath

Gating model fitted for a sequence of penalty parameters. An object of class glmnet.

expertsPath

A list of J expert models fitted for a sequence of penalty parameters. These are objects of class glmnet.


schiffner/EMnet documentation built on May 29, 2019, 3:38 p.m.