[Docs] Document nested-metric keys in ResultGrid.get_best_result (#30463)#63445
Open
dstrodtman wants to merge 3 commits into
Open
[Docs] Document nested-metric keys in ResultGrid.get_best_result (#30463)#63445dstrodtman wants to merge 3 commits into
dstrodtman wants to merge 3 commits into
Conversation
…-project#30463) Add an example to `ResultGrid.get_best_result` showing how to refer to metrics reported in a nested result dict. Tune flattens result dicts with `/` as the delimiter before storing them in `metric_analysis`, so the correct form is a slash-separated flat key like `"eval/metrics/loss"`. Target: python/ray/tune/result_grid.py. Closes ray-project#30463 [DOC-987] Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the documentation for the get_best_result method in ResultGrid to explain how to reference nested metrics using slash-separated keys. The feedback suggests clarifying that the forward slash is the default delimiter, as this behavior can be configured via environment variables.
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
pseudo-rnd-thoughts
approved these changes
Jun 2, 2026
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Douglas Strodtman <douglas@anyscale.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds an example to
ResultGrid.get_best_resultshowing how to refer to metrics that are reported in a nested result dict. Tune flattens reported result dicts with/as the delimiter before storing them inmetric_analysis, so a nested entry like{"eval": {"metrics": {"loss": 0.1}}}is queried withmetric="eval/metrics/loss". The docstring previously gave no guidance on this form, which is what the linked issue asked for.Related issues
Closes #30463
[DOC-987]
Additional information
Target:
python/ray/tune/result_grid.py. The slash-separated flat-key form is the only form supported byget_best_result—metricis used directly as a key into the flattenedmetric_analysisdict inExperimentAnalysis.get_best_trial(seepython/ray/tune/experiment/trial.pyupdate_last_result, which callsflatten_dictwith the default/delimiter before updating per-metric stats).Generated with Claude Code