Skip to content

fippy/scalar-loss-function

Pack Severity Fix Versions
fippy error none, edit by hand All versions

fippy.Explainer expects an observation-wise loss L(y, yhat) -> np.ndarray of shape (n_obs,). Passing an aggregate scalar metric from sklearn.metrics (such as mean_absolute_error or mean_squared_error) collapses observation-wise scores to a constant, breaking ExplanationResult.test() and per-observation attribution.

explainer = fippy.Explainer(model.predict, X_train, loss=mean_absolute_error)
explainer = fippy.Explainer(model.predict, X_train, loss=fippy.losses.absolute_error)

Calls to Explainer(...) that pass a known aggregate scalar metric as the loss argument.

Pass fippy.losses.absolute_error, fippy.losses.squared_error, or a custom function returning one loss value per observation.

fippy.Explainer requires an observation-wise loss returning shape (n_obs,), not an aggregate scalar metric. Use fippy.losses.absolute_error, fippy.losses.squared_error, or a per-observation loss function.

See all rules in the fippy pack.