GroupConstraint#

class tagarnina.optimization.GroupConstraint(*, features: list[str], min_features: int, max_features: int)[source]#

Bound the number of selected features within a group.

The number of selected features in features must lie between min_features and max_features. A max_features larger than the group size is reduced to the group size.

Parameters:
featureslist of str

Names of the features in the group. Must be unique.

min_featuresint

Minimum number of selected features in the group.

max_featuresint

Maximum number of selected features in the group.

Methods

__init__(*, features, min_features, max_features)

Attributes

features

min_features

max_features