code: def get_filters(sweep, metrics, alpha=5, sample=0.25, b=2500):
      """Use empirical bootstrap to estimate filter ranges per metric for good errors."""
      assert len(sweep), "Sweep cannot be empty."
      errs = np.array(get_vals(sweep, "error"))
      n, b, filters = len(errs), int(b), {}
      percentiles = [alpha / 2, 50, 100 - alpha / 2]
      n_sample = int(sample) if sample > 1 else max(1, int(n * sample))
      samples = [np.random.choice(n, n_sample) for _ in range(b)]
      samples = [s[np.argmin(errs[s])] for s in samples]
      for metric in metrics:
          vals = np.array(get_vals(sweep, metric))
          vals = [vals[s] for s in samples]
          v_min, v_med, v_max = tuple(np.percentile(vals, percentiles))
          filters[metric] = [v_min, v_med, v_max]
      return filters
  
file_path: pycls/pycls/sweep/analysis.py
imports: import json
  from functools import reduce
  from operator import getitem
  import numpy
label_desc: Use image node_id 7 for calling a global function with example usage: get_filters(sweep, metrics, alpha, sample, b) and returns: filters