tfl.utils.canonicalize_monotonicity
Converts string constants representing monotonicity into integers.
tfl.utils.canonicalize_monotonicity(
monotonicity, allow_decreasing=True
)
Args |
monotonicity
|
The monotonicities hyperparameter of a tfl.layers Layer
(e.g. tfl.layers.PWLCalibration ).
|
allow_decreasing
|
If decreasing monotonicity is considered a valid
monotonicity.
|
Returns |
monotonicity represented as -1, 0, 1, or None.
|
Raises |
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-02 UTC.
[null,null,["Last updated 2024-08-02 UTC."],[],[]]