docstr: Helper method to wrangle a datasource into the format that the underlying model requires.
  :param ds: EncodedDS that contains the dataframe to transform.
  :param output_dtype:
  :return: modified `data` object that conforms to XGBoost's expected format.
docstr_tok: ["Helper","method","to","wrangle","a","datasource","into","the","format","that","the","underlying","model","requires",".",":","param","ds",":","EncodedDS","that","contains","the","dataframe","to","transform",".",":","param","output_dtype",":",":","return",":","modified","`","data","`","object","that","conforms","to","XGBoost","'s","expected","format","."]
code: def _to_dataset(self, ds: EncodedDs, output_dtype: str, mode="train"):
      """
      Helper method to wrangle a datasource into the format that the underlying model requires.
      :param ds: EncodedDS that contains the dataframe to transform.
      :param output_dtype:
      :return: modified `data` object that conforms to XGBoost's expected format.
      """  # noqa
      data = None
      for input_col in self.input_cols:
          if data is None:
              data = ds.get_encoded_column_data(input_col).to(
                  self.device
              )
          else:
              enc_col = ds.get_encoded_column_data(input_col).to(
                  self.device
              )
              data = torch.cat((data, enc_col.to(self.device)), 1)
  
      data = data.cpu().numpy()
  
      if mode in ("train", "dev"):
          label_data = ds.get_column_original_data(self.target)
          if output_dtype in self.cls_dtypes:
              if mode == "train":  # TODO weight maps?
                  self.ordinal_encoder = OrdinalEncoder()
                  self.label_set = list(set(label_data))
                  self.ordinal_encoder.fit(
                      np.array(list(self.label_set)).reshape(-1, 1)
                  )
  
              filtered_label_data = []
              for x in label_data:
                  if x in self.label_set:
                      filtered_label_data.append(x)
  
              label_data = self.ordinal_encoder.transform(
                  np.array(filtered_label_data).reshape(-1, 1)
              ).flatten()
  
          elif output_dtype == dtype.integer:
              label_data = label_data.clip(
                  -pow(2, 63), pow(2, 63)
              ).astype(int)
          elif output_dtype in self.float_dtypes:
              label_data = label_data.astype(float)
  
          return data, label_data
  
      else:
          return data
  
imports: from typing import Dict, List, Optional, Union
  import time
  import torch
  import optuna
  import xgboost
  import numpy
  import pandas
  from sklearn.preprocessing import OrdinalEncoder
  from type_infer.dtype import dtype
  from lightwood.helpers.log import log
  from lightwood.helpers.parallelism import get_nr_procs
  from lightwood.mixer.base import BaseMixer
  from lightwood.encoder.base import BaseEncoder
  from lightwood.api.types import PredictionArguments
  from lightwood.data.encoded_ds import EncodedDs
label_desc: Use image node_id 2 for calling the XGBoostMixer obj's underlying member method code with example usage: obj._to_dataset(ds, output_dtype, mode) and returns: data,  label_data, data