tfl.pwl_calibration_layer.PWLCalibrationConstraints

Monotonicity and bounds constraints for PWL calibration layer.

Applies an approximate L2 projection to the weights of a PWLCalibration layer such that the result satisfies the specified constraints.

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

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

View source

Standard Keras config for serialization.

__call__

View source

Applies constraints to w.