Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[air/docs] Add example to fetch results dataframe for trainer/tuner #28067

Merged
merged 4 commits into from
Aug 27, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions doc/source/ray-air/doc_code/tuner.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ def get_another_dataset():
# __tune_optimization_end__

# __result_grid_inspection_start__
from ray.air.config import RunConfig
from ray.tune import Tuner, TuneConfig

tuner = Tuner(
Expand All @@ -201,7 +200,11 @@ def get_another_dataset():
# And the best metrics
best_metric = best_result.metrics

# Inspect all results
# Or a dataframe for further analysis
results_df = best_result.metrics_dataframe
krfricke marked this conversation as resolved.
Show resolved Hide resolved
print("Shortest training time:", results_df["time_total_s"].min())

# Iterate over results
for result in result_grid:
if result.error:
print("The trial had an error:", result.error)
Expand Down
5 changes: 4 additions & 1 deletion doc/source/ray-air/trainer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,11 @@ You can interact with a `Result` object as follows:
# returns the final metrics as reported
result.metrics

# returns the contain an Exception if training failed.
# returns the Exception if training failed.
result.error

# Returns a pandas dataframe of all reported results
results.metrics_dataframe
krfricke marked this conversation as resolved.
Show resolved Hide resolved
krfricke marked this conversation as resolved.
Show resolved Hide resolved


See :class:`the Result docstring <ray.air.result.Result>` for more details.