docstr: Create a Lightwood datasource from a data frame and some encoders. This class inherits from `torch.utils.data.Dataset`.
  
  Note: normal behavior is to cache encoded representations to avoid duplicated computations. If you want an option to disable, this please open an issue.
   
  :param encoders: list of Lightwood encoders used to encode the data per each column.
  :param data_frame: original dataframe.
  :param target: name of the target column to predict.
docstr_tok: ["Create","a","Lightwood","datasource","from","a","data","frame","and","some","encoders",".","This","class","inherits","from","`","torch.utils.data.Dataset","`",".","Note",":","normal","behavior","is","to","cache","encoded","representations","to","avoid","duplicated","computations",".","If","you","want","an","option","to","disable",",","this","please","open","an","issue",".",":","param","encoders",":","list","of","Lightwood","encoders","used","to","encode","the","data","per","each","column",".",":","param","data_frame",":","original","dataframe",".",":","param","target",":","name","of","the","target","column","to","predict","."]
code: def __init__(
      self,
      encoders: Dict[str, BaseEncoder],
      data_frame: pd.DataFrame,
      target: str,
  ) -> None:
      """
      Create a Lightwood datasource from a data frame and some encoders. This class inherits from `torch.utils.data.Dataset`.
  
      Note: normal behavior is to cache encoded representations to avoid duplicated computations. If you want an option to disable, this please open an issue.
  
      :param encoders: list of Lightwood encoders used to encode the data per each column.
      :param data_frame: original dataframe.
      :param target: name of the target column to predict.
      """  # noqa
      self.data_frame = data_frame
      self.encoders = encoders
      self.target = target
      self.encoder_spans = {}
      self.input_length = 0  # feature tensor dim
  
      # save encoder span, has to use same iterator as in __getitem__ for correct indeces
      for col in self.data_frame:
          if col != self.target and self.encoders.get(col, False):
              self.encoder_spans[col] = (
                  self.input_length,
                  self.input_length + self.encoders[col].output_size,
              )
              self.input_length += self.encoders[col].output_size
  
      # if cache enabled, we immediately build it
      self.use_cache = True
      self.cache_built = False
      self.X_cache: torch.Tensor = torch.full(
          (len(self.data_frame),), fill_value=torch.nan
      )
      self.Y_cache: torch.Tensor = torch.full(
          (len(self.data_frame),), fill_value=torch.nan
      )
      self.build_cache()
  
imports: import inspect
  from typing import List, Tuple, Dict
  import torch
  import numpy
  import pandas
  from torch.utils.data import Dataset
  from lightwood.encoder.base import BaseEncoder
label_desc: Use image node_id 1 to create a new EncodedDs object from inherited base classes: Dataset with example: obj = EncodedDs(encoders, data_frame, target)