check_n_features#

skactiveml.utils.check_n_features(obj, X, reset)[source]#

Validate and update the expected number of features of an estimator.

Parameters:
objobject

Estimator-like object expected to expose n_features_in_.

Xarray-like of shape (n_samples, n_features)

Input data whose second dimension determines the number of features.

resetbool

If True, set obj.n_features_in_ from X. If False, validate X against the existing value of obj.n_features_in_.

Raises:
ValueError

If reset=False and X does not match the stored number of features.