ddn3.strong_rule

Functions that implements the strong rule strategy in DDN 3.0

Module Contents

Functions

strong_rule(X, y, lambda1)

Find the variables to keep using the strong rule

lasso(y, X, lambda1, beta_in[, tol, use_strong_rule, ...])

Compute lasso with strong rule that eliminates variables

ddn3.strong_rule.strong_rule(X, y, lambda1)

Find the variables to keep using the strong rule

This rule eliminates a set of variables that will generally not be selected by Lasso. Let N be the sample size. Let P be the feature size.

Parameters:
  • X (array_like) – The predictors. Shape N by P-1.

  • y (array_like) – The response variables. Shape N by 1.

  • lambda1 (float) – DDN parameter lambda1.

Returns:

idx – List of indices to keep

Return type:

ndarray

ddn3.strong_rule.lasso(y, X, lambda1, beta_in, tol=1e-06, use_strong_rule=True, use_warm=False)

Compute lasso with strong rule that eliminates variables

Let N be the sample size. Let P be the feature size.

Parameters:
  • y (array-like) – The response variable. Size N by 1.

  • X (array_like) – The predictor. Size N by P-1

  • lambda1 (float) – DDN parameter lambda1.

  • beta_in (array_like) – Initial lasso coefficient. Size P-1 by 1.

  • tol (float) – Lasso tolerance.

  • use_strong_rule (bool) – Apply strong rule or not. Strong rule will eliminate some predictors.

  • use_warm (bool) – Apply warm start or not.

Returns:

beta – The estimated lasso coefficients. Size P-1.

Return type:

ndarray