Skip to content

← optimization package

SparsePenalty

A penalty encouraging sparse (few nonzeros) solutions, as a proximal operator for the classic l1 norm.

The operator penalizes the sum of absolute values in the input, which has the side effect of reducing the number of non-zero elements in the input, depending on the given degree of sparsity. The operation applied by the operator is also known as soft thresholding. A less common use case is to employ an alternative non- convex norm via the norm parameter and the associated shape parameter, which can yield better results in practice (given a careful choice of solver and problem setup) which however sacrifices the otherwise guaranteed global optimality. Like all proximal operators, this is normally used as part of the optimization problem formulation given to a (typically convex) solver node. Version 1.0.0

Ports/Properties

data

Data to process.

verbose name
Data
default value
None
port type
DataPort
value type
object (can be None)
data direction
INOUT

step_size

Step size.

verbose name
Step Size
default value
None
port type
DataPort
value type
float (can be None)
data direction
IN

step_count

Current step count for outer solver.

verbose name
Step Count
default value
None
port type
DataPort
value type
int (can be None)
data direction
IN

sparsity

Degree of sparsity in the solution. Larger values will encourage a higher degree of sparsity in the input to this node.

verbose name
Sparsity
default value
1.0
port type
FloatPort
value type
float (can be None)

norm

Alternative non-convex norm to use. Any other value than the default of l1 will result in a non-convex penalty, where global optimality guarantees are lost. However, in practice, and given the right solver, these norms can be more effective at encouraging sparsity than the convex l1 norm. Most importantly, the l1 norm is biased towards solutions with a small overall magnitude, whereas non-convex norms are closer to penalizing the number of non-zeros with a lower bias towards lower magnitude of those retained non-zeros. Successful usage of these norms requires skilled choice of problem structure and solver or extensive experimentation.

verbose name
Norm
default value
l1
port type
EnumPort
value type
str (can be None)

norm_shape

Shape parameter for the alternative norm. In case of the lq norm this is q (between 0 and 1), the power of the norm. for q- shrinkage, this is q (between -inf and 1), the shrinkage factor. For SCAD, this is the a parameter (a good default is 3.7). For MCP, this is the psi (also named gamma) parameter.

verbose name
Norm Parameter (If Norm Is Not L1)
default value
None
port type
FloatPort
value type
float (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)