Repository navigation
Avoid all-NaN warnings when computing percentile reference - #6893
Conversation
MedianPruner warnings for all-NaN intermediate values
|
Update for On unchanged current |
MedianPruner warnings for all-NaN intermediate values|
CI update for the current Read the Docs reports “Build terminated due to time out.” Its public build log shows the final Sphinx command starting but no Sphinx exit code or source error before termination. The previous PR-head build and a current I have not made a source change for a build that timed out. A retry of the external Read the Docs build would help distinguish a transient timeout from a reproducible problem. |
gen740
left a comment
There was a problem hiding this comment.
The fix looks good to me. I left a few minor suggestions to simplify the implementation and make the warning checks more consistent.
|
@kAIto47802 Could you review this PR? |
… values
Fixed by returning NaN directly in _get_best_intermediate_result_over_steps
and _get_percentile_intermediate_result_over_trials when all intermediate
values are NaN, avoiding np.nanmin/np.nanmax and np.nanpercentile
from emitting 'All-NaN slice encountered' warnings.
Updated existing tests to use simplefilter('error') so the leak cannot
regress.
Fixes optuna#6872
2f6fd2c to
e736ecc
Compare
Summary
Follow-up to #6873 and #6872. The merged fix in #6873 handles all-NaN values within one trial when finding its best intermediate result. A separate path still passes all-NaN values from completed trials to
np.nanpercentile, emittingRuntimeWarning: All-NaN slice encounteredwhile returning NaN. I merged currentmasterinto this branch and narrowed this PR to that remaining percentile reference calculation.For a nonempty all-NaN array, the helper now returns NaN before aggregation. The existing test changes from suppressing the warning to treating it as an error. The
n_min_trialscheck and empty-array behavior remain intact. The published diff is two files, six additions and two deletions.Validation
master, a direct reproduction emits the warning in both minimize and maximize modes; on this branch it emits none.UserWarnings.AI assisted the implementation and review. I inspected the merged upstream change, resolved the conflicts, and ran the checks above.