AtMostKConstraint#

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

Select at most max_features features from a group.

Equivalent to a GroupConstraint with min_features=0.

Parameters:
featureslist of str

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

max_featuresint

Maximum number of selected features in the group.

Methods

__init__(*, features, max_features)

Attributes

min_features

features

max_features