elastic.net.lm: Fitting Linear Models with Elastic Net Penalty

Description Usage Arguments Value

View source: R/elastic.net.lm.R

Description

Implementation of the MM algorithm solver for a linear regression model with an elastic net penalty term.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
elastic.net.lm(
  formula,
  data,
  lambda,
  alpha,
  intercept = F,
  standardize = F,
  beta.init = NULL,
  beta.tol = 0,
  loss.tol = 1e-06,
  eps = 1e-06,
  seed = NULL,
  verbose = 0
)

Arguments

formula

an object of class formula: a symbolic description of the model to be fitted following the standard of lm.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment (formula), typically the environment from which this function is called.

lambda

penalty term scaling hyperparameter.

alpha

L1-weight hyperparameter in elastic net penalty term.

intercept

optional boolean indicating whether to fit an intercept. If TRUE, standardize is ignored. Default is FALSE.

standardize

optional boolean indicating whether to return results for standardized data. If intercept is TRUE, this argument is ignored. Default is FALSE. TRUE, standardize is ignored. Default is FALSE.

beta.init

optional initial beta parameters to use in the MM algorithm. Default is NULL.

beta.tol

optional absolute tolerance for rounding down parameter standardized estimates. If the absolute value of a parameter estimate in the standardized model is smaller than beta.tol, it is rounded down to zero. Default is 0, that is, no rounding.

loss.tol

optional convergence tolerance on the elastic net loss in the MM algorithm. Default is 1e-6.

eps

optional correction term to avoid rounding by zero. Default is 1e-6.

seed

optional seed. Default is NULL.

verbose

optional number indicating per how many iterations the estimation progress is displayed. Default is 0, that is, no progress updates.

Value

elastic.net.lm returns an object of class mlkit.lm.fit. An object of class mlkit.lm.fit is a list containing at least the following components:

coefficients

a named vector of optimal coefficients.

loss

residual sum of squares plus elastic net loss for optimal coefficients.

r2

coefficient of determination for optimal coefficients.

adj.r2

adjusted coefficient of determination for optimal coefficients.


Accelerytics/mlkit documentation built on Dec. 31, 2020, 9:46 a.m.