| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
compute_numeric() passed its values straight to np.histogram, which raises
on NaN/+-Inf:
ValueError: autodetected range of [0.05, inf] is not finite
Non-finite values arise from ordinary feature engineering - a click-through
rate whose denominator is zero, a log of zero, or missing values encoded as
NaN. compute_all() has no per-column error handling, so a single such value
discarded the metrics for the entire feature view, including columns that
were perfectly well-formed.
The failure was silent from the caller's perspective: the monitoring API
still returned HTTP 200 with status "completed" and computed_features 0, so
the UI showed no error - the feature view was simply absent from the
Monitoring page.
Filter non-finite values once, after nulls are dropped, so every statistic
is computed over finite data, and apply the existing _safe_float/opt_float
helpers to min_val, max_val and the quantiles (previously only mean and
stddev were guarded, letting Inf leak into the stored metrics).
row_count/null_count continue to describe the raw data.
The same unguarded np.histogram call is duplicated in the Dask offline
store's _dask_compute_numeric_metrics, and is fixed there too.
Signed-off-by: Piyush Mondal <piyushmondal182004@gmail.com>
| Back | FazBrowse Home | New Git URL |
ISSUE FIX:- #6783
What this PR does / why we need it:
MetricsCalculator.compute_numeric() passed values straight to
np.histogram(), which raises on NaN/+-Inf:
Non-finite values arise from ordinary feature engineering - a
click-through rate whose denominator is zero, a log of zero, or missing
values encoded as NaN. compute_all() has no per-column error handling,
so a single such value discarded the metrics for the entire feature view,
including columns that were perfectly well-formed.
The failure was silent from the caller's perspective: the monitoring API
still returned HTTP 200 with "status": "completed" and
"computed_features": 0, so the UI showed no error - the feature view was
simply absent from the Monitoring page.
This PR filters non-finite values once, after nulls are dropped, so every
statistic is computed over finite data, and applies the existing
_safe_float/opt_float helpers to min_val, max_val and the
quantiles (previously only mean and stddev were guarded, letting Inf
leak into stored metrics). row_count/null_count continue to describe
the raw data.
The same unguarded np.histogram call is duplicated in the Dask offline
store's _dask_compute_numeric_metrics, and is fixed there too.
Verification
Before: a feature view containing one inf value produced zero metrics
for all of its features. After: full metrics are produced, computed
correctly over the finite values (verified against an identical feature
view with no inf, which behaved correctly on both sides).
Full unit suite: 315 passed, 24 skipped. 6 new regression tests added.
Which issue(s) this PR fixes:
Fixes #<ISSUE_NUMBER>
Checks
Testing Strategy