deel.lip.constraints
This module contains extra constraint objects. These object can be added as params to regular layers.
AutoWeightClipConstraint ¶
AutoWeightClipConstraint(scale=1)
Bases: Constraint
Clips the weights incident to each hidden unit to be inside the range [-c,+c]
.
With c = 1/sqrt(size(kernel)).
PARAMETER | DESCRIPTION |
---|---|
scale |
scaling factor to increase/decrease clipping value.
TYPE:
|
Source code in deel/lip/constraints.py
41 42 43 44 45 46 47 48 49 |
|
FrobeniusConstraint ¶
FrobeniusConstraint(eps=1e-07)
Bases: Constraint
Constrain the weights by dividing the weight matrix by it's L2 norm.
Source code in deel/lip/constraints.py
63 64 65 66 67 |
|
SpectralConstraint ¶
SpectralConstraint(
k_coef_lip=1.0,
eps_spectral=DEFAULT_EPS_SPECTRAL,
eps_bjorck=DEFAULT_EPS_BJORCK,
beta_bjorck=DEFAULT_BETA_BJORCK,
u=None,
)
Bases: Constraint
Ensure that all singular values of the weight matrix equals to 1. Computation based on Bjorck algorithm. The computation is done in two steps:
- reduce the larget singular value to k_coef_lip, using iterate power method.
- increase other singular values to k_coef_lip, using bjorck algorithm.
PARAMETER | DESCRIPTION |
---|---|
k_coef_lip |
lipschitz coefficient of the weight matrix
TYPE:
|
eps_spectral |
stopping criterion for the iterative power algorithm.
TYPE:
|
eps_bjorck |
stopping criterion Bjorck algorithm.
TYPE:
|
beta_bjorck |
beta parameter in bjorck algorithm.
TYPE:
|
u |
vector used for iterated power method, can be set to None (used for serialization/deserialization purposes).
TYPE:
|
Source code in deel/lip/constraints.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
WeightClipConstraint ¶
WeightClipConstraint(c=2)
Bases: Constraint
Clips the weights incident to each hidden unit to be inside the range [-c,+c]
.
PARAMETER | DESCRIPTION |
---|---|
c |
clipping parameter.
TYPE:
|
Source code in deel/lip/constraints.py
23 24 25 26 27 28 29 30 |
|