chop.penalties — chop documentation

# chop.penalties

## Penalties.

This module contains classes representing penalties / regularizers. They function batch-wise, similar to objects in chop.constraints. Reshaping will be of order if the penalties are used on the parameters of a model.

Code inspired from https://github.com/openopt/copt/.

The proximal operators are derived e.g. in https://www.di.ens.fr/~fbach/opt_book.pdf.

Classes

`GroupL1`(alpha, groups) | Group LASSO penalty.
`L1`(alpha) | L1 penalty. Batch-wise function. For each element in the batch, the L1 penalty is given by ..math:: Omega(x) = lpha |x|_1.

class `chop.penalties.` `GroupL1`(alpha, groups)

  Group LASSO penalty. Batch-wise function.

  `prox`(x, step_size=None)

    Returns the proximal operator for the (non overlapping) Group L1 norm. :param x: torch.Tensor of shape (batch_size, *) :param step_size: float or torch.Tensor of shape (batch_size,)

class `chop.penalties.` `L1`(alpha: float)

  L1 penalty. Batch-wise function. For each element in the batch, the L1 penalty is given by ..math:

      \Omega(x) = lpha \|x\|_1

  `prox`(x, step_size=None)

    Proximal operator for the L1 norm penalty. This is given by soft-thresholding.

    Parameters

      - x – torch.Tensor x has shape (batch_size, *)

      - step_size – float or torch.Tensor of shape (batch_size,)