Skip to content

← optimization package

ProximalGradientDescentSolve

Iteratively solve a convex optimization problems using the proximal gradient descent method.

This node can solve (find the minimum of) a wide range of convex optimization problems common in machine learning and engineering sciences, both smooth and non-smooth. If the problem is smooth, then a cost function to minimize, which is a function of some vector- or matrix-shaped weights to optimize (w), optionally along with a scalar bias (b) that is also optimized, and provided data (D), is wired into the "cost" input as a graph with placeholders of same name. This is then solved via gradient descent (or optionally accelerated gradient descent). Alternatively, if the cost is further subject to a hard constraint, a small graph that applies one of the constraint nodes to the weights w may be wired into the "constraint" input; this is then solved via projected gradient descent (optionally accelerated). Lastly, if the cost function has a non-smooth term (e.g., a regularization term), then a graph that uses one of the proximal operator nodes (or which manually implements a proximal operator corresponding to the desired non-smooth term) can be wired into the "prox" input; in this case the problem is solved via proximal gradient descent (this is also known as the ISTA algorithm or, if accelerated, FISTA). In simple cases, the initial weights can be omitted, but in the general case, initial weights (e.g., an appropriately shaped all-zeros array or packet) must be provided since otherwise the shape is unknown. Like with all solve nodes, the solution is differentiable, meaning that the node can be used in a place where gradients are taken, for example in the network graph a DeepModel node. More Info... Version 0.2.0

Ports/Properties

data

Data to process.

verbose name
Data
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
IN

weights

Initial and final weights. If not set, will be initialized to a packet equivalent to a single all-zeroes instance of the training-data.

verbose name
Weights
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
INOUT

bias

Optional estimated bias, if used as second argument in cost.

verbose name
Bias
default value
None
port type
DataPort
value type
AnyNumeric (can be None)
data direction
OUT

state

Optional initial and final solver state.

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

cost

Smooth part of cost function given some data.

verbose name
Cost
default value
None
port type
GraphPort
value type
Graph

cost__signature

Signature for the "cost" input. This represents the signature for the subgraph that is wired into the "cost" port. This is formatted as in (a,b,c) where a,b,c are names of placeholders that are expected in the subgraph that goes into the "cost" port. Alternatively, it can also be provided in data structure form as a list of lists, as in: [['a','b','c']].

verbose name
Cost [Signature]
default value
(w,b,D)
port type
Port
value type
object (can be None)

prox

Optional proximal operator of non-smooth term(s).

verbose name
Prox
default value
None
port type
GraphPort
value type
Graph

prox__signature

Signature for the "prox" input. This represents the signature for the subgraph that is wired into the "prox" port. This is formatted as in (a,b,c) where a,b,c are names of placeholders that are expected in the subgraph that goes into the "prox" port. Alternatively, it can also be provided in data structure form as a list of lists, as in: [['a','b','c']].

verbose name
Prox [Signature]
default value
(w,step)
port type
Port
value type
object (can be None)

constraint

Optional hard constraints.

verbose name
Constraint
default value
None
port type
GraphPort
value type
Graph

constraint__signature

Signature for the "constraint" input. This represents the signature for the subgraph that is wired into the "constraint" port. This is formatted as in (a,b,c) where a,b,c are names of placeholders that are expected in the subgraph that goes into the "constraint" port. Alternatively, it can also be provided in data structure form as a list of lists, as in: [['a','b','c']].

verbose name
Constraint [Signature]
default value
(w)
port type
Port
value type
object (can be None)

hyper_params

Hyper-parameters for the cost function. This is a dictionary of arbitrary key-value pairs that can be used to configure the cost function and proximal operators. The respective graphs may then declare and use placeholders named the same as of the dictionary keys.

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

max_iter

Maximum number of iterations.

verbose name
Max Iter
default value
500
port type
IntPort
value type
int (can be None)

abstol

Absolute convergence tolerance. If weights change less than this (after normalization by step size), the optimization terminates. Note that this depends on the data scale.

verbose name
Abstol
default value
0.001
port type
FloatPort
value type
float (can be None)

stepsize

Optional step size. If unspecified, the step size is adapted automatically using back-tracking line search.

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

max_backtrack

Maximum number of line search steps per iteration. Only used if step size is left to automatic.

verbose name
Max Backtrack
default value
15
port type
IntPort
value type
int (can be None)

backtrack_factor

Backtracking line search factor. Only used if stepsize is 0. The default depends on the chosen algorithm, and is 0.5 for PGD.

verbose name
Backtrack Factor
default value
None
port type
FloatPort
value type
float (can be None)

acceleration

Whether to use Nesterov acceleration. This will usually lead to faster convergence at minimal per-iteration overhead.

verbose name
Acceleration
default value
True
port type
BoolPort
value type
bool (can be None)

use_jit

If enabled, attempt to use JIT compilation for the inner loop. This incurs a one-time compilation cost, but the actual solving will be greatly accelerated if using the GPU.

verbose name
Use Jit
default value
auto
port type
EnumPort
value type
str (can be None)

unroll

Whether to unroll the optimization loop. This can save some per-iteration overhead, but the benefit depends on the specific use case.

verbose name
Unroll
default value
auto
port type
EnumPort
value type
str (can be None)

implicit_diff

Whether to use implicit differentiation for computing gradients. The alternative is to unroll the solver iterations.

verbose name
Implicit Diff
default value
True
port type
BoolPort
value type
bool (can be None)

verbosity

Verbosity level. 0: no output, 1: per-iteration summary. Note that JIT will be disabled if verbosity is used.

verbose name
Verbosity
default value
0
port type
IntPort
value type
int (can be None)

incremental_updates

Whether to use incremental updates from the previous state. If not set, the previous or wired-in state is ignored.

verbose name
Incremental Updates
default value
False
port type
BoolPort
value type
bool (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)