tfl.pwl_calibration_layer.PWLCalibrationConstraints

View source on GitHub

Class 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.

Attributes:

  • All __init__ arguments.

__init__

View source

__init__(
    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
)

Initializes an instance of PWLCalibration.

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

__call__

View source

__call__(w)

Applies constraints to w.

get_config

View source

get_config()

Standard Keras config for serialization.