class_docstr: Implements the strategy of stopping a trial if its performance
  doesn't reach a pre-specified threshold by a certain progression.
class_docstr_tok: ["Implements","the","strategy","of","stopping","a","trial","if","its","performance","does","n't","reach","a","pre-specified","threshold","by","a","certain","progression","."]
docstr: Stop a trial if its performance doesn't reach a pre-specified threshold
  by `min_progression`.
  
  Args:
      trial_indices: Indices of candidate trials to consider for early stopping.
      experiment: Experiment that contains the trials and other contextual data.
  
  Returns:
      A dictionary mapping trial indices that should be early stopped to
      (optional) messages with the associated reason. An empty dictionary
      means no suggested updates to any trial's status.
docstr_tok: ["Stop","a","trial","if","its","performance","does","n't","reach","a","pre-specified","threshold","by","`","min_progression","`",".","Args",":","trial_indices",":","Indices","of","candidate","trials","to","consider","for","early","stopping",".","experiment",":","Experiment","that","contains","the","trials","and","other","contextual","data",".","Returns",":","A","dictionary","mapping","trial","indices","that","should","be","early","stopped","to","(","optional",")","messages","with","the","associated","reason",".","An","empty","dictionary","means","no","suggested","updates","to","any","trial","'s","status","."]
code: def should_stop_trials_early(
      self,
      trial_indices: Set[int],
      experiment: Experiment,
      **kwargs: Dict[str, Any],
  ) -> Dict[int, Optional[str]]:
      """Stop a trial if its performance doesn't reach a pre-specified threshold
      by `min_progression`.
  
      Args:
          trial_indices: Indices of candidate trials to consider for early stopping.
          experiment: Experiment that contains the trials and other contextual data.
  
      Returns:
          A dictionary mapping trial indices that should be early stopped to
          (optional) messages with the associated reason. An empty dictionary
          means no suggested updates to any trial's status.
      """
      metric_name, minimize = self._default_objective_and_direction(
          experiment=experiment
      )
      data = self._check_validity_and_get_data(
          experiment=experiment, metric_names=[metric_name]
      )
      if data is None:
          # don't stop any trials if we don't get data back
          return {}
  
      map_key = next(iter(data.map_keys))
      df = data.map_df
  
      # default checks on `min_progression` and `min_curves`; if not met, don't do
      # early stopping at all and return {}
      if not self.is_eligible_any(
          trial_indices=trial_indices,
          experiment=experiment,
          df=df,
          map_key=map_key,
      ):
          return {}
  
      df_objective = df[df["metric_name"] == metric_name]
      decisions = {
          trial_index: self.should_stop_trial_early(
              trial_index=trial_index,
              experiment=experiment,
              df=df_objective,
              map_key=map_key,
              minimize=minimize,
          )
          for trial_index in trial_indices
      }
      return {
          trial_index: reason
          for trial_index, (should_stop, reason) in decisions.items()
          if should_stop
      }
  
file_path: Ax/ax/early_stopping/strategies/threshold.py
imports: from logging import Logger
  from typing import Any, Dict, Iterable, List, Optional, Set, Tuple
  import pandas
  from ax.core.experiment import Experiment
  from ax.early_stopping.strategies.base import BaseEarlyStoppingStrategy
  from ax.exceptions.core import UnsupportedError
  from ax.utils.common.logger import get_logger
label_desc: Use image node_id 2 for calling the ThresholdEarlyStoppingStrategy obj's underlying member method code with example usage: obj.should_stop_trials_early(trial_indices, experiment) and returns: unknown, dict, dict