View source on GitHub |
Monotonicity and bounds constraints for PWL calibration layer.
tfl.pwl_calibration_layer.PWLCalibrationConstraints(
monotonicity='none',
convexity='none',
lengths=None,
output_min=None,
output_max=None,
output_min_constraints=tfl.pwl_calibration_lib.BoundConstraintsType.NONE
,
output_max_constraints=tfl.pwl_calibration_lib.BoundConstraintsType.NONE
,
num_projection_iterations=8
)
Applies an approximate L2 projection to the weights of a PWLCalibration layer such that the result satisfies the specified constraints.
Args | |
---|---|
monotonicity
|
Same meaning as corresponding parameter of PWLCalibration .
|
convexity
|
Same meaning as corresponding parameter of PWLCalibration .
|
lengths
|
Lengths of pieces of piecewise linear function. Needed only if convexity is specified. |
output_min
|
Minimum possible output of pwl function. |
output_max
|
Maximum possible output of pwl function. |
output_min_constraints
|
A tfl.pwl_calibration_lib.BoundConstraintsType
describing the constraints on the layer's minimum value.
|
output_max_constraints
|
A tfl.pwl_calibration_lib.BoundConstraintsType
describing the constraints on the layer's maximum value.
|
num_projection_iterations
|
Same meaning as corresponding parameter of
PWLCalibration .
|
Methods
from_config
@classmethod
from_config( config )
Instantiates a weight constraint from a configuration dictionary.
Example:
constraint = UnitNorm()
config = constraint.get_config()
constraint = UnitNorm.from_config(config)
Args | |
---|---|
config
|
A Python dictionary, the output of get_config .
|
Returns | |
---|---|
A tf.keras.constraints.Constraint instance.
|
get_config
get_config()
Standard Keras config for serialization.
__call__
__call__(
w
)
Applies constraints to w.