mirror of
https://github.com/vale981/ray
synced 2025-03-05 10:01:43 -05:00
[air/docs] Add example to fetch results dataframe for trainer/tuner (#28067)
This commit is contained in:
parent
e6b0d5f95d
commit
bbd13ddc33
2 changed files with 9 additions and 3 deletions
|
@ -176,7 +176,6 @@ config = TuneConfig(
|
|||
# __tune_optimization_end__
|
||||
|
||||
# __result_grid_inspection_start__
|
||||
from ray.air.config import RunConfig
|
||||
from ray.tune import Tuner, TuneConfig
|
||||
|
||||
tuner = Tuner(
|
||||
|
@ -201,7 +200,11 @@ best_checkpoint = best_result.checkpoint
|
|||
# And the best metrics
|
||||
best_metric = best_result.metrics
|
||||
|
||||
# Inspect all results
|
||||
# Or a dataframe for further analysis
|
||||
results_df = result_grid.get_dataframe()
|
||||
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)
|
||||
|
|
|
@ -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
|
||||
result.metrics_dataframe
|
||||
|
||||
|
||||
See :class:`the Result docstring <ray.air.result.Result>` for more details.
|
||||
|
|
Loading…
Add table
Reference in a new issue