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: Construct a ThresholdEarlyStoppingStrategy instance.
  
  Args
      metric_names: A (length-one) list of name of the metric to observe. If
          None will default to the objective metric on the Experiment's
          OptimizationConfig.
      seconds_between_polls: How often to poll the early stopping metric to
          evaluate whether or not the trial should be early stopped.
      metric_threshold: The metric threshold that a trial needs to reach by
          min_progression in order not to be stopped.
      min_progression: Only stop trials if the latest progression value
          (e.g. timestamp, epochs, training data used) is greater than this
          threshold. Prevents stopping prematurely before enough data is gathered
          to make a decision.
      max_progression: Do not stop trials that have passed `max_progression`.
          Useful if we prefer finishing a trial that are already near completion.
      min_curves: Trials will not be stopped until a number of trials
          `min_curves` have completed with curve data attached. That is, if
          `min_curves` trials are completed but their curve data was not
          successfully retrieved, further trials may not be early-stopped.
      trial_indices_to_ignore: Trial indices that should not be early stopped.
      true_objective_metric_name: The actual objective to be optimized; used in
          situations where early stopping uses a proxy objective (such as training
          loss instead of eval loss) for stopping decisions.
      normalize_progressions: Normalizes the progression column of the MapData df
          by dividing by the max. If the values were originally in [0, `prog_max`]
          (as we would expect), the transformed values will be in [0, 1]. Useful
          for inferring the max progression and allows `min_progression` to be
          specified in the transformed space. IMPORTANT: Typically, `min_curves`
          should be > 0 to ensure that at least one trial has completed and that
          we have a reliable approximation for `prog_max`.
docstr_tok: ["Construct","a","ThresholdEarlyStoppingStrategy","instance",".","Args","metric_names",":","A","(","length-one",")","list","of","name","of","the","metric","to","observe",".","If","None","will","default","to","the","objective","metric","on","the","Experiment's","OptimizationConfig",".","seconds_between_polls",":","How","often","to","poll","the","early","stopping","metric","to","evaluate","whether","or","not","the","trial","should","be","early","stopped",".","metric_threshold",":","The","metric","threshold","that","a","trial","needs","to","reach","by","min_progression","in","order","not","to","be","stopped",".","min_progression",":","Only","stop","trials","if","the","latest","progression","value","(","e.g",".","timestamp",",","epochs",",","training","data","used",")","is","greater","than","this","threshold",".","Prevents","stopping","prematurely","before","enough","data","is","gathered","to","make","a","decision",".","max_progression",":","Do","not","stop","trials","that","have","passed","`","max_progression","`",".","Useful","if","we","prefer","finishing","a","trial","that","are","already","near","completion",".","min_curves",":","Trials","will","not","be","stopped","until","a","number","of","trials","`","min_curves","`","have","completed","with","curve","data","attached",".","That","is",",","if","`","min_curves","`","trials","are","completed","but","their","curve","data","was","not","successfully","retrieved",",","further","trials","may","not","be","early-stopped",".","trial_indices_to_ignore",":","Trial","indices","that","should","not","be","early","stopped",".","true_objective_metric_name",":","The","actual","objective","to","be","optimized",";","used","in","situations","where","early","stopping","uses","a","proxy","objective","(","such","as","training","loss","instead","of","eval","loss",")","for","stopping","decisions",".","normalize_progressions",":","Normalizes","the","progression","column","of","the","MapData","df","by","dividing","by","the","max",".","If","the","values","were","originally","in","[","0",",","`","prog_max","`","]","(","as","we","would","expect",")",",","the","transformed","values","will","be","in","[","0",",","1","]",".","Useful","for","inferring","the","max","progression","and","allows","`","min_progression","`","to","be","specified","in","the","transformed","space",".","IMPORTANT",":","Typically",",","`","min_curves","`","should","be",">","0","to","ensure","that","at","least","one","trial","has","completed","and","that","we","have","a","reliable","approximation","for","`","prog_max","`","."]
code: def __init__(
      self,
      metric_names: Optional[Iterable[str]] = None,
      seconds_between_polls: int = 300,
      metric_threshold: float = 0.2,
      min_progression: Optional[float] = 10,
      max_progression: Optional[float] = None,
      min_curves: Optional[int] = 5,
      trial_indices_to_ignore: Optional[List[int]] = None,
      true_objective_metric_name: Optional[str] = None,
      normalize_progressions: bool = False,
  ) -> None:
      """Construct a ThresholdEarlyStoppingStrategy instance.
  
      Args
          metric_names: A (length-one) list of name of the metric to observe. If
              None will default to the objective metric on the Experiment's
              OptimizationConfig.
          seconds_between_polls: How often to poll the early stopping metric to
              evaluate whether or not the trial should be early stopped.
          metric_threshold: The metric threshold that a trial needs to reach by
              min_progression in order not to be stopped.
          min_progression: Only stop trials if the latest progression value
              (e.g. timestamp, epochs, training data used) is greater than this
              threshold. Prevents stopping prematurely before enough data is gathered
              to make a decision.
          max_progression: Do not stop trials that have passed `max_progression`.
              Useful if we prefer finishing a trial that are already near completion.
          min_curves: Trials will not be stopped until a number of trials
              `min_curves` have completed with curve data attached. That is, if
              `min_curves` trials are completed but their curve data was not
              successfully retrieved, further trials may not be early-stopped.
          trial_indices_to_ignore: Trial indices that should not be early stopped.
          true_objective_metric_name: The actual objective to be optimized; used in
              situations where early stopping uses a proxy objective (such as training
              loss instead of eval loss) for stopping decisions.
          normalize_progressions: Normalizes the progression column of the MapData df
              by dividing by the max. If the values were originally in [0, `prog_max`]
              (as we would expect), the transformed values will be in [0, 1]. Useful
              for inferring the max progression and allows `min_progression` to be
              specified in the transformed space. IMPORTANT: Typically, `min_curves`
              should be > 0 to ensure that at least one trial has completed and that
              we have a reliable approximation for `prog_max`.
      """
      super().__init__(
          metric_names=metric_names,
          seconds_between_polls=seconds_between_polls,
          true_objective_metric_name=true_objective_metric_name,
          min_progression=min_progression,
          max_progression=max_progression,
          min_curves=min_curves,
          trial_indices_to_ignore=trial_indices_to_ignore,
          normalize_progressions=normalize_progressions,
      )
      self.metric_threshold = metric_threshold
  
      if metric_names is not None and len(list(metric_names)) > 1:
          raise UnsupportedError(
              "ThresholdEarlyStoppingStrategy only supports a single metric. Use "
              "LogicalEarlyStoppingStrategy to compose early stopping strategies "
              "with multiple metrics."
          )
  
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 1 to create a new ThresholdEarlyStoppingStrategy object from inherited base classes: BaseEarlyStoppingStrategy with example: obj = ThresholdEarlyStoppingStrategy(metric_names, seconds_between_polls, metric_threshold, min_progression, max_progression, min_curves, trial_indices_to_ignore, true_objective_metric_name, normalize_progressions)