Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfl.categorical_calibration_lib.project

View source on GitHub

Monotonicity/bounds constraints implementation for categorical calibration.

tfl.categorical_calibration_lib.project(
    weights, output_min, output_max, monotonicities
)

Returns the approximate L2 projection of the CategoricalCalibration weights into the constrained parameter space.

Args:

  • weights: Tensor which represents weights of Categorical calibration layer.
  • output_min: Lower bound constraint on weights.
  • output_max: Upper bound constraint on weights.
  • monotonicities: List of pair of indices (i, j), indicating constraint weight[i] <= weight[j].

Returns:

Projected weights tensor.

Raises:

  • ValueError: If monotonicities are not of the correct format or are circular.