class_docstr: Defines and formats data for the Alpha158 dataset.
  
  Attributes:
    column_definition: Defines input and data type of column used in the
      experiment.
    identifiers: Entity identifiers used in experiments.
docstr: Calibrates scalers using the data supplied.
  
  Args:
    df: Data to use to calibrate scalers.
code: def set_scalers(self, df):
      """Calibrates scalers using the data supplied.
  
      Args:
        df: Data to use to calibrate scalers.
      """
      print("Setting scalers with training data...")
  
      column_definitions = self.get_column_definition()
      id_column = utils.get_single_col_by_input_type(
          InputTypes.ID, column_definitions
      )
      target_column = utils.get_single_col_by_input_type(
          InputTypes.TARGET, column_definitions
      )
  
      # Extract identifiers in case required
      self.identifiers = list(df[id_column].unique())
  
      # Format real scalers
      real_inputs = utils.extract_cols_from_data_type(
          DataTypes.REAL_VALUED,
          column_definitions,
          {InputTypes.ID, InputTypes.TIME},
      )
  
      data = df[real_inputs].values
      self._real_scalers = sklearn.preprocessing.StandardScaler().fit(
          data
      )
      self._target_scaler = sklearn.preprocessing.StandardScaler().fit(
          df[[target_column]].values
      )  # used for predictions
  
      # Format categorical scalers
      categorical_inputs = utils.extract_cols_from_data_type(
          DataTypes.CATEGORICAL,
          column_definitions,
          {InputTypes.ID, InputTypes.TIME},
      )
  
      categorical_scalers = {}
      num_classes = []
      for col in categorical_inputs:
          # Set all to str so that we don't have mixed integer/string columns
          srs = df[col].apply(str)
          categorical_scalers[
              col
          ] = sklearn.preprocessing.LabelEncoder().fit(srs.values)
          num_classes.append(srs.nunique())
  
      # Set categorical scaler outputs
      self._cat_scalers = categorical_scalers
      self._num_classes_per_cat_input = num_classes
  
file_path: qlib/examples/benchmarks/TFT/data_formatters/qlib_Alpha158.py
imports: import data_formatters.base
  import libs.utils
  import sklearn.preprocessing
label_desc: Use image node_id 3 for calling the Alpha158Formatter obj's underlying member method code with example usage: obj.set_scalers(df) without return types