normalize_constraints
def normalize_constraints(constraints, n_features: int, feature_names=None) -> list[int] | None
from compileml.compile import normalize_constraints
Normalize to a list of -1/0/+1 per feature, or None if unconstrained.
Accepts a positional sequence, a dict keyed by feature index, or —
when feature_names is given — a dict keyed by feature name.
Parameters#
| Name | Type | Default | Kind |
|---|---|---|---|
| constraints | — | required | positional |
| n_features | int | required | positional |
| feature_names | — | None | positional |
Returns#
list[int] | None
Raises#
- ValueError
Read from the function body and the private helpers it calls, not inferred. A function that raises nothing has no section here.