class_docstr: A class representing a global relative binning approach. This binning first
  rescales all input series by their respective mean (relative) and then
  performs one binning across all series (global).
  
  Parameters
  ----------
  num_bins
      The number of discrete bins/buckets that we want values to be mapped
      to.
      (default: 1024)
  is_quantile
      Whether the binning is quantile or linear. Quantile binning allocated
      bins based on the cumulative distribution function, while linear
      binning allocates evenly spaced bins.
      (default: True, i.e. quantile binning)
  
  linear_scaling_limit
      The linear scaling limit. Values which are larger than
      linear_scaling_limit times the mean will be capped at
      linear_scaling_limit.
      (default: 10)
  quantile_scaling_limit
      The quantile scaling limit. Values which are larger than the quantile
      evaluated at quantile_scaling_limit will be capped at the quantile
      evaluated at quantile_scaling_limit.
      (default: 0.99)
code: def initialize_from_array(
      self,
      input_array: np.ndarray,
      ctx: mx.Context = get_mxnet_context(),
  ):
      # Calculate bin centers and bin edges using linear or quantile binning.
      if self.is_quantile:
          bin_centers = np.quantile(
              input_array,
              np.linspace(
                  0, self.quantile_scaling_limit, self.num_bins
              ),
          )
          bin_centers = ensure_binning_monotonicity(bin_centers)
      else:
          has_negative_data = np.any(input_array < 0)
          low = -self.linear_scaling_limit if has_negative_data else 0
          high = self.linear_scaling_limit
          bin_centers = np.linspace(low, high, self.num_bins)
      bin_edges = bin_edges_from_bin_centers(bin_centers)
  
      # Store bin centers and edges since their are globally applicable to
      # all time series.
      with ctx:
          self.bin_edges.initialize()
          self.bin_centers.initialize()
      self.bin_edges.set_data(mx.nd.array(bin_edges))
      self.bin_centers.set_data(mx.nd.array(bin_centers))
  
file_path: gluonts/src/gluonts/mx/representation/global_relative_binning.py
imports: from typing import List, Optional, Tuple
  import mxnet
  import numpy
  from gluonts.core.component import validated
  from gluonts.dataset.common import Dataset
  from gluonts.mx import Tensor
  from gluonts.mx.context import get_mxnet_context
  from .binning_helpers import bin_edges_from_bin_centers, ensure_binning_monotonicity
  from .representation import Representation
label_desc: Use image node_id 3 for calling the GlobalRelativeBinning obj's underlying member method code with example usage: obj.initialize_from_array(input_array, ctx) without return types