validate_data#

validate_data(_estimator: BaseEstimator, /, X: ArrayLike, **kwargs) ndarray[source][source]#

Validate X and set n_features_in_ and n_samples_in_ on the estimator.

Thin wrapper around sklearn’s validate_data that additionally stores the number of samples as _estimator.n_samples_in_ when reset=True (i.e. during fit), which is required for default penalty computation.

Within a skip_validation context, sklearn’s checks are bypassed and X is only coerced to a numpy array; the fitted attributes are still set when reset=True.

Parameters:
_estimatorBaseEstimator

The estimator being fitted or applied. Modified in-place.

Xarray-like of shape (n_samples, n_features)

Data to validate.

**kwargs

Forwarded to sklearn.utils.validation.validate_data.

Returns:
Xndarray of shape (n_samples, n_features)

Validated array.