mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -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__
|
# __tune_optimization_end__
|
||||||
|
|
||||||
# __result_grid_inspection_start__
|
# __result_grid_inspection_start__
|
||||||
from ray.air.config import RunConfig
|
|
||||||
from ray.tune import Tuner, TuneConfig
|
from ray.tune import Tuner, TuneConfig
|
||||||
|
|
||||||
tuner = Tuner(
|
tuner = Tuner(
|
||||||
|
@ -201,7 +200,11 @@ best_checkpoint = best_result.checkpoint
|
||||||
# And the best metrics
|
# And the best metrics
|
||||||
best_metric = best_result.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:
|
for result in result_grid:
|
||||||
if result.error:
|
if result.error:
|
||||||
print("The trial had an error:", 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
|
# returns the final metrics as reported
|
||||||
result.metrics
|
result.metrics
|
||||||
|
|
||||||
# returns the contain an Exception if training failed.
|
# returns the Exception if training failed.
|
||||||
result.error
|
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.
|
See :class:`the Result docstring <ray.air.result.Result>` for more details.
|
||||||
|
|
Loading…
Add table
Reference in a new issue