Skip to content

Raise when mape has only near zero targets - #1049

Open
Hashim1999164 wants to merge 1 commit into
uber:masterfrom
Hashim1999164:fix/mape-empty-nan
Open

Raise when mape has only near zero targets#1049
Hashim1999164 wants to merge 1 commit into
uber:masterfrom
Hashim1999164:fix/mape-empty-nan

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Sep 10, 2026

Copy link
Copy Markdown

Fixes #1047

mape was taking the mean of an empty slice when every target sat inside EPS, so it returned nan. smape did the same when y and p were all zero.

Those paths now raise ValueError, matching ape refusing a near zero target. Valid inputs still go through the old formula.

Tests cover the happy path and the empty filter case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mape silently returns NaN when all targets are near-zero (empty filtered slice)

1 participant