class_docstr: Rescale and quantize the target variable.
  Requires `past_target_field`, and `future_target_field` to be present.
  
  The mean absolute value of the past_target is used to rescale
  past_target and future_target. Then the bin_edges are used to quantize
  the rescaled target.
  
  The calculated scale is stored in the `scale_field`.
  
  Parameters
  ----------
  bin_edges
      The bin edges for quantization.
  past_target_field, optional
      The field name that contains `past_target`,
      by default "past_target"
  past_observed_values_field, optional
      The field name that contains `past_observed_values`,
      by default "past_observed_values"
  future_target_field, optional
      The field name that contains `future_target`,
      by default "future_target"
  scale_field, optional
      The field name where scale will be stored,
      by default "scale"
class_docstr_tok: ["Rescale","and","quantize","the","target","variable",".","Requires","`","past_target_field","`",",","and","`","future_target_field","`","to","be","present",".","The","mean","absolute","value","of","the","past_target","is","used","to","rescale","past_target","and","future_target",".","Then","the","bin_edges","are","used","to","quantize","the","rescaled","target",".","The","calculated","scale","is","stored","in","the","`","scale_field","`",".","Parameters","--","--","--","--","--","bin_edges","The","bin","edges","for","quantization",".","past_target_field",",","optional","The","field","name","that","contains","`","past_target","`",",","by","default","``","past_target","''","past_observed_values_field",",","optional","The","field","name","that","contains","`","past_observed_values","`",",","by","default","``","past_observed_values","''","future_target_field",",","optional","The","field","name","that","contains","`","future_target","`",",","by","default","``","future_target","''","scale_field",",","optional","The","field","name","where","scale","will","be","stored",",","by","default","``","scale","''"]
code: def __init__(
      self,
      bin_edges: List[float],
      past_target_field: str = "past_target",
      past_observed_values_field: str = "past_observed_values",
      future_target_field: str = "future_target",
      scale_field: str = "scale",
  ):
      self.bin_edges = np.array(bin_edges)
      self.future_target_field = future_target_field
      self.past_target_field = past_target_field
      self.past_observed_values_field = past_observed_values_field
      self.scale_field = scale_field
  
imports: from typing import Callable, Iterator, List, Optional, Tuple, Type
  import numpy
  from toolz import valmap
  from gluonts.core.component import validated, tensor_to_numpy
  from gluonts.dataset.common import DataEntry
  from gluonts.exceptions import assert_data_error
  from ._base import FlatMapTransformation, MapTransformation, SimpleTransformation
label_desc: Use image node_id 1 to create a new QuantizeMeanScaled object from inherited base classes: SimpleTransformation with example: obj = QuantizeMeanScaled(bin_edges, past_target_field, past_observed_values_field, future_target_field, scale_field)