Converts string constants representing monotonicities into integers.
tfl.utils.canonicalize_monotonicities(
monotonicities, allow_decreasing=True
)
Args |
monotonicities
|
monotonicities hyperparameter of a tfl.layers Layer (e.g.
tfl.layers.Lattice ).
|
allow_decreasing
|
If decreasing monotonicity is considered a valid
monotonicity.
|
Returns |
A list of monotonicities represented as -1, 0, 1, or the value None
if monotonicities is None.
|
Raises |
ValueError
|
If one of monotonicities is not in the set
{-1, 0, 1, 'decreasing', 'none', 'increasing'} and allow_decreasing is
True.
|
ValueError
|
If one of monotonicities is not in the set
{0, 1, 'none', 'increasing'} and allow_decreasing is False.
|