code: def get_numeric_conf_range(
      all_confs: np.ndarray,
      df_target_stddev: dict = {},
      positive_domain: bool = False,
      std_tol: int = 1,
      group: Optional[str] = "__default",
      fixed_conf: float = None,
  ):
      """
      Gets prediction bounds for numerical targets, based on ICP estimation and width tolerance.
  
      :param all_confs: All possible bounds depending on confidence level.
      :param df_target_stddev: Observed train standard deviation for each group target.
      :param positive_domain: Flag that indicates whether target is expected to be a positive number.
      :param std_tol: Tolerance for automatic confidence level selection; bigger tolerance means higher confidence, in general.
      :param group: For tasks with multiple different target groups (where each may have a different std_dev), indicates what group is being considered.
      :param fixed_conf: Pre-determined confidence for the ICP, 0-1 bounded. Can be specified to bypass automatic confidence/bound detection, or to adjust the threshold sensitivity in anomaly detection tasks.
  
      :return: array with confidence for each data instance, along with lower and upper bounds for each prediction.
      """  # noqa
  
      if fixed_conf is None:
          significances = []
          conf_ranges = []
          std_dev = df_target_stddev[group]
          tolerance = std_dev * std_tol
  
          for sample_idx in range(all_confs.shape[0]):
              sample = all_confs[sample_idx, :, :]
              for idx in range(sample.shape[1]):
                  significance = (99 - idx) / 100
                  diff = sample[1, idx] - sample[0, idx]
                  if diff <= tolerance:
                      conf_range = list(sample[:, idx])
                      significances.append(significance)
                      conf_ranges.append(conf_range)
                      break
              else:
                  significances.append(
                      0.9991
                  )  # default: confident that value falls inside big bounds
                  bounds = sample[:, 0]
                  sigma = (bounds[1] - bounds[0]) / 4
                  conf_range = [bounds[0] - sigma, bounds[1] + sigma]
                  conf_ranges.append(conf_range)
  
          conf_ranges = np.array(conf_ranges)
      else:
          # fixed error rate
          conf = max(0.01, min(1.0, fixed_conf))
          error_rate = 1 - conf
          conf_idx = int(100 * error_rate) - 1
          conf_ranges = all_confs[:, :, conf_idx]
          significances = [conf for _ in range(conf_ranges.shape[0])]
  
      if positive_domain:
          conf_ranges[conf_ranges < 0] = 0
      return np.array(significances), conf_ranges
  
file_path: lightwood/lightwood/analysis/nc/util.py
imports: from typing import Union, Optional
  import torch
  import numpy
  import pandas
  from torch.nn.functional import softmax
  from type_infer.dtype import dtype
label_desc: Use image node_id 4 for calling a global function with example usage: get_numeric_conf_range(all_confs, df_target_stddev, positive_domain, std_tol, group, fixed_conf) and returns: np,  conf_ranges