class_docstr: Median Stopping-Rule similar to Golovin et al.
  "Google Vizier: A Service for Black-Box Optimization".
  
  * For a Trial `t`, the best objective value is found.
  * Then the best objective value for every other trial is found.
  * Finally, the best-objective for the trial is compared to the median of
    the best-objectives of all other trials.
  
  If trial `t`'s best objective is worse than that median, it is
  stopped.
  
  If `t` has not reached the minimum iterations or there are not
  yet the requested number of comparison trials, `t` is not
  stopped. If `t` is all nan's it is stopped by default.
  
  Args:
      min_iterations (int): the minimum number of iterations a trial runs for
          before it is considered for stopping.
      min_trials (int): the minimum number of comparison trials needed for a
          trial to be stopped.
class_docstr_tok: ["Median","Stopping-Rule","similar","to","Golovin","et","al",".","``","Google","Vizier",":","A","Service","for","Black-Box","Optimization","''",".","*","For","a","Trial","`","t","`",",","the","best","objective","value","is","found",".","*","Then","the","best","objective","value","for","every","other","trial","is","found",".","*","Finally",",","the","best-objective","for","the","trial","is","compared","to","the","median","of","the","best-objectives","of","all","other","trials",".","If","trial","`","t","`","'s","best","objective","is","worse","than","that","median",",","it","is","stopped",".","If","`","t","`","has","not","reached","the","minimum","iterations","or","there","are","not","yet","the","requested","number","of","comparison","trials",",","`","t","`","is","not","stopped",".","If","`","t","`","is","all","nan","'s","it","is","stopped","by","default",".","Args",":","min_iterations","(","int",")",":","the","minimum","number","of","iterations","a","trial","runs","for","before","it","is","considered","for","stopping",".","min_trials","(","int",")",":","the","minimum","number","of","comparison","trials","needed","for","a","trial","to","be","stopped","."]
code: def __init__(self, min_iterations=0, min_trials=1):
      self.min_iterations = min_iterations
      self.min_trials = min_trials
  
imports: import os
  import random
  import numpy
  import logging
  import sherpa
  import pandas
  import sklearn.gaussian_process
  from sherpa.core import Choice, Continuous, Discrete, Ordinal, AlgorithmState
  from sherpa.core import rng
  import sklearn.model_selection
  import collections
label_desc: Use image node_id 1 to create a new MedianStoppingRule object from inherited base classes: StoppingRule with example: obj = MedianStoppingRule(min_iterations, min_trials)