class_docstr: A class representing a Trial object.
  
  A Trial object is usually obtained from :func:`determined.experimental.client.get_trial`.
  Trial reference class used for querying relevant :class:`~determined.experimental.Checkpoint`
  instances.
  
  Attributes:
      trial_id: ID of trial.
      session: HTTP request session.
      experiment_id: (Mutable, Optional[int]) ID of the experiment this trial belongs to.
      hparams: (Mutable, Optional[Dict]) Dict[name, value] of the trial's hyperparameters.
          This is an instance of the hyperparameter space defined by the experiment.
      state: (Mutable, Optional[TrialState]) Trial state (ex: ACTIVE, PAUSED, COMPLETED).
      summary_metrics: (Mutable, Optional[Dict]) Summary metrics for the trial. Includes
          aggregated metrics for training and validation steps for each reported metric name.
          Example:
  
          .. code::
  
              {
                  "avg_metrics": {
                      "loss": {
                          "count": 100,
                          "last": 0.2,
                          "max": 0.4,
                          "min", 0.2,
                          "sum": 1.2,
                          "type": "number",
                      }
              }
  
  Note:
      All attributes are cached by default.
  
      The :attr:`hparams` and :attr:`summary_metrics` attributes are mutable and may be changed
      by methods that update these values, either automatically or explicitly with :meth:`reload`.
class_docstr_tok: ["A","class","representing","a","Trial","object",".","A","Trial","object","is","usually","obtained","from",":","func",":","`","determined.experimental.client.get_trial","`",".","Trial","reference","class","used","for","querying","relevant",":","class",":","`","~determined.experimental.Checkpoint","`","instances",".","Attributes",":","trial_id",":","ID","of","trial",".","session",":","HTTP","request","session",".","experiment_id",":","(","Mutable",",","Optional","[","int","]",")","ID","of","the","experiment","this","trial","belongs","to",".","hparams",":","(","Mutable",",","Optional","[","Dict","]",")","Dict","[","name",",","value","]","of","the","trial","'s","hyperparameters",".","This","is","an","instance","of","the","hyperparameter","space","defined","by","the","experiment",".","state",":","(","Mutable",",","Optional","[","TrialState","]",")","Trial","state","(","ex",":","ACTIVE",",","PAUSED",",","COMPLETED",")",".","summary_metrics",":","(","Mutable",",","Optional","[","Dict","]",")","Summary","metrics","for","the","trial",".","Includes","aggregated","metrics","for","training","and","validation","steps","for","each","reported","metric","name",".","Example",":","..","code",":",":","{","``","avg_metrics","''",":","{","``","loss","''",":","{","``","count","''",":","100",",","``","last","''",":","0.2",",","``","max","''",":","0.4",",","``","min","''",",","0.2",",","``","sum","''",":","1.2",",","``","type","''",":","``","number","''",",","}","}","Note",":","All","attributes","are","cached","by","default",".","The",":","attr",":","`","hparams","`","and",":","attr",":","`","summary_metrics","`","attributes","are","mutable","and","may","be","changed","by","methods","that","update","these","values",",","either","automatically","or","explicitly","with",":","meth",":","`","reload","`","."]
docstr: Return the :class:`~determined.experimental.Checkpoint` instance with the best
  validation metric as defined by the ``sort_by`` and ``smaller_is_better``
  arguments.
  
  Arguments:
      sort_by (string, optional): The name of the validation metric to
          order checkpoints by. If this parameter is unset the metric defined
          in the related experiment configuration searcher field will be
          used.
  
      smaller_is_better (bool, optional): Whether to sort the
          metric above in ascending or descending order. If ``sort_by`` is unset,
          this parameter is ignored. By default, the value of ``smaller_is_better``
          from the experiment's configuration is used.
code: def top_checkpoint(
      self,
      sort_by: Optional[str] = None,
      smaller_is_better: Optional[bool] = None,
  ) -> checkpoint.Checkpoint:
      """
      Return the :class:`~determined.experimental.Checkpoint` instance with the best
      validation metric as defined by the ``sort_by`` and ``smaller_is_better``
      arguments.
  
      Arguments:
          sort_by (string, optional): The name of the validation metric to
              order checkpoints by. If this parameter is unset the metric defined
              in the related experiment configuration searcher field will be
              used.
  
          smaller_is_better (bool, optional): Whether to sort the
              metric above in ascending or descending order. If ``sort_by`` is unset,
              this parameter is ignored. By default, the value of ``smaller_is_better``
              from the experiment's configuration is used.
      """
      warnings.warn(
          "Trial.top_checkpoint() has been deprecated and will be removed in a future "
          "version."
          "Please call Trial.list_checkpoints(...,max_results=1) instead.",
          FutureWarning,
          stacklevel=2,
      )
      order_by = None
      if sort_by:
          order_by = OrderBy.ASC if smaller_is_better else OrderBy.DESC
  
      checkpoints = self.list_checkpoints(
          sort_by=sort_by,
          order_by=order_by,
          max_results=1,
      )
      if not checkpoints:
          raise ValueError("No checkpoints found for criteria.")
      return checkpoints[0]
  
imports: import datetime
  import enum
  import inspect
  import warnings
  from typing import Any, Dict, Iterable, List, Optional, Union
  from determined.common import api, util
  from determined.common.api import bindings, logs
  from determined.common.experimental import checkpoint, metrics
  from determined.common.experimental._util import OrderBy
label_desc: Use image node_id 6 for calling the Trial obj's underlying member method code with example usage: obj.top_checkpoint(sort_by, smaller_is_better) and returns: checkpoints