Motivation
DiscreteNoLabelDuplicatesConstraint and DiscreteLinkedParametersConstraint are two extremes of the same degeneracy concept (value repetition across a parameter group). They can be unified into a single DiscreteDegeneracyConstraint parametrized by n_max_occurrences (the maximum number of times any single value may appear in a row), combined with the inherited exclude flag.
n_max_occurrences=1 → keep only all-distinct rows (old DiscreteNoLabelDuplicatesConstraint)
n_max_occurrences=M-1, exclude=True → keep only all-identical rows (old DiscreteLinkedParametersConstraint, with M the number of parameters)
Todo
Code Refs
DiscreteNoLabelDuplicatesConstraint: baybe/constraints/discrete.py:220-260 (pandas + Polars)
DiscreteLinkedParametersConstraint: baybe/constraints/discrete.py:263-297 (pandas + Polars)
- Deprecation pattern to mirror (`DiscreteExclu
Motivation
DiscreteNoLabelDuplicatesConstraintandDiscreteLinkedParametersConstraintare two extremes of the same degeneracy concept (value repetition across a parameter group). They can be unified into a singleDiscreteDegeneracyConstraintparametrized byn_max_occurrences(the maximum number of times any single value may appear in a row), combined with the inheritedexcludeflag.n_max_occurrences=1→ keep only all-distinct rows (oldDiscreteNoLabelDuplicatesConstraint)n_max_occurrences=M-1, exclude=True→ keep only all-identical rows (oldDiscreteLinkedParametersConstraint, withMthe number of parameters)Todo
DiscreteDegeneracyConstraintwithn_max_occurrences: int = 1(default = all-distinct), reusing the inheritedexcludeflag.n_max_occurrencestimes).DiscreteDegeneracyConstraint; add cattrs (de)serialization redirects for the old class names; cover intests/test_deprecations.py.DiscreteDegeneracyConstraint.Code Refs
DiscreteNoLabelDuplicatesConstraint:baybe/constraints/discrete.py:220-260(pandas + Polars)DiscreteLinkedParametersConstraint:baybe/constraints/discrete.py:263-297(pandas + Polars)