aif360.sklearn.utils.check_inputs

aif360.sklearn.utils.check_inputs(X, y, sample_weight=None, ensure_2d=True)[source]

Input validation for debiasing algorithms.

Checks all inputs for consistent length, validates shapes (optional for X), and returns an array of all ones if sample_weight is None.

Parameters:
  • X (array-like) – Input data.

  • y (array-like, shape = (n_samples,)) – Target values.

  • sample_weight (array-like, optional) – Sample weights.

  • ensure_2d (bool, optional) – Whether to raise a ValueError if X is not 2D.

Returns:

tuple – * X (array-like) – Validated X. Unchanged.

  • y (array-like) – Validated y. Possibly converted to 1D if not a pandas.Series.

  • sample_weight (array-like) – Validated sample_weight. If no sample_weight is provided, returns a consistent-length array of ones.