tfl.utils.canonicalize_monotonicity

Converts string constants representing monotonicity into integers.

monotonicity The monotonicities hyperparameter of a tfl.layers Layer (e.g. tfl.layers.PWLCalibration).
allow_decreasing If decreasing monotonicity is considered a valid monotonicity.

monotonicity represented as -1, 0, 1, or None.

ValueError If monotonicity is not in the set {-1, 0, 1, 'decreasing', 'none', 'increasing'} and allow_decreasing is True.
ValueError If monotonicity is not in the set {0, 1, 'none', 'increasing'} and allow_decreasing is False.