# tfl.utils.canonicalize_trust

<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/utils.py#L157-L193) |

Converts string constants representing trust direction into integers.

    tfl.utils.canonicalize_trust(
        trusts
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `trusts` | edgeworth_trusts or trapezoid_trusts hyperparameter of [`tfl.layers.Lattice`](https://www.tensorflow.org/lattice/api_docs/python/tfl/layers/Lattice) layer. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A list of trust constraint tuples of the form (feature_a, feature_b, direction) where direction can be -1 or 1, or the value None if trusts is None. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If one of trust constraints does not have 3 elements. |
| `ValueError` | If one of trust constraints' direction is not in the set {-1, 1, 'negative', 'positive'}. |

<br />