# tfl.categorical_calibration_layer.CategoricalCalibrationConstraints

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/categorical_calibration_layer.py#L289-L332) |

Monotonicity and bounds constraints for categorical calibration layer.

    tfl.categorical_calibration_layer.CategoricalCalibrationConstraints(
        output_min=None, output_max=None, monotonicities=None
    )

Updates the weights of CategoricalCalibration layer to satify bound and
monotonicity constraints. The update is an approximate L2 projection into the
constrained parameter space.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `output_min` | Minimum possible output of categorical function. |
| `output_max` | Maximum possible output of categorical function. |
| `monotonicities` | Monotonicities of CategoricalCalibration layer. |

<br />

## Methods

### `from_config`

    @classmethod
    from_config(
        config
    )

Instantiates a weight constraint from a configuration dictionary.

#### Example:

    constraint = UnitNorm()
    config = constraint.get_config()
    constraint = UnitNorm.from_config(config)

<br />

<br />

<br />

| Args ||
|---|---|
| `config` | A Python dictionary, the output of `get_config`. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A [`tf.keras.constraints.Constraint`](https://www.tensorflow.org/api_docs/python/tf/keras/constraints/Constraint) instance. ||

<br />

### `get_config`

[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/categorical_calibration_layer.py#L326-L332)

    get_config()

Standard Keras config for serialization.

### `__call__`

[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/categorical_calibration_layer.py#L318-L324)

    __call__(
        w
    )

Applies constraints to w.