class_docstr: The ``TabularRegressionData`` class is a :class:`~flash.core.data.data_module.DataModule` with a set of
  classmethods for loading data for tabular regression.
class_docstr_tok: ["The","``","TabularRegressionData","``","class","is","a",":","class",":","`","~flash.core.data.data_module.DataModule","`","with","a","set","of","classmethods","for","loading","data","for","tabular","regression","."]
docstr: Creates a :class:`~flash.tabular.regression.data.TabularRegressionData` object from the given data (in the
  form of list of a tuple or a dictionary).
  
  .. note::
  
      The ``categorical_fields``, ``numerical_fields``, and ``target_field`` do not need to be provided if
      ``parameters`` are passed instead. These can be obtained from the
      :attr:`~flash.tabular.data.TabularData.parameters` attribute of the
      :class:`~flash.tabular.data.TabularData` object that contains your training data.
  
  The targets will be extracted from the ``target_field`` in the data frames.
  To learn how to customize the transforms applied for each stage, read our
  :ref:`customizing transforms guide <customizing_transforms>`.
  
  Args:
      categorical_fields: The fields (column names) in the dictionary containing categorical data.
      numerical_fields: The fields (column names) in the dictionary containing numerical data.
      target_field: The field (column name) in the dictionary containing the targets.
      parameters: Parameters to use if ``categorical_fields``, ``numerical_fields``, and ``target_field`` are not
          provided (e.g. when loading data for inference or validation).
      train_list: The data to use when training.
      val_list: The data to use when validating.
      test_list: The data to use when testing.
      predict_list: The data to use when predicting.
      input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the data.
      transform: The :class:`~flash.core.data.io.input_transform.InputTransform` type to use.
      transform_kwargs: Dict of keyword arguments to be provided when instantiating the transforms.
      data_module_kwargs: Additional keyword arguments to provide to the
        :class:`~flash.core.data.data_module.DataModule` constructor.
  
  Returns:
      The constructed :class:`~flash.tabular.regression.data.TabularRegressionData`.
  
  Examples
  ________
  
  .. testsetup::
  
      >>> train_data = [
      ...     {"age": 2, "animal": "cat", "weight": 6},
      ...     {"age": 4, "animal": "dog", "weight": 10},
      ...     {"age": 1, "animal": "cat", "weight": 5},
      ... ]
      >>> predict_data = [
      ...     {"animal": "dog", "weight": 7},
      ...     {"animal": "dog", "weight": 12},
      ...     {"animal": "cat", "weight": 5},
      ... ]
  
  We have a list of dictionaries ``train_data`` with the following contents:
  
  .. code-block::
  
      [
          {"age": 2, animal": "cat", "weight": 6},
          {"age": 4, animal": "dog", "weight": 10},
          {"age": 1, animal": "cat", "weight": 5},
      ]
  
  and a list of dictionaries ``predict_data`` with the following contents:
  
  .. code-block::
  
      [
          {"animal": "dog", "weight": 7},
          {"animal": "dog", "weight": 12},
          {"animal": "cat", "weight": 5},
      ]
  
  .. doctest::
  
      >>> from flash import Trainer
      >>> from flash.tabular import TabularRegressor, TabularRegressionData
      >>> datamodule = TabularRegressionData.from_lists(
      ...     "animal",
      ...     "weight",
      ...     "age",
      ...     train_list=train_data,
      ...     predict_list=predict_data,
      ...     batch_size=4,
      ... )
      >>> model = TabularRegressor.from_data(datamodule, backbone="tabnet")
      >>> trainer = Trainer(fast_dev_run=True)
      >>> trainer.fit(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      Training...
      >>> trainer.predict(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
      Predicting...
  
  .. testcleanup::
  
      >>> del train_data
      >>> del predict_data
docstr_tok: ["Creates","a",":","class",":","`","~flash.tabular.regression.data.TabularRegressionData","`","object","from","the","given","data","(","in","the","form","of","list","of","a","tuple","or","a","dictionary",")",".","..","note",":",":","The","``","categorical_fields","``",",","``","numerical_fields","``",",","and","``","target_field","``","do","not","need","to","be","provided","if","``","parameters","``","are","passed","instead",".","These","can","be","obtained","from","the",":","attr",":","`","~flash.tabular.data.TabularData.parameters","`","attribute","of","the",":","class",":","`","~flash.tabular.data.TabularData","`","object","that","contains","your","training","data",".","The","targets","will","be","extracted","from","the","``","target_field","``","in","the","data","frames",".","To","learn","how","to","customize","the","transforms","applied","for","each","stage",",","read","our",":","ref",":","`","customizing","transforms","guide","<","customizing_transforms",">","`",".","Args",":","categorical_fields",":","The","fields","(","column","names",")","in","the","dictionary","containing","categorical","data",".","numerical_fields",":","The","fields","(","column","names",")","in","the","dictionary","containing","numerical","data",".","target_field",":","The","field","(","column","name",")","in","the","dictionary","containing","the","targets",".","parameters",":","Parameters","to","use","if","``","categorical_fields","``",",","``","numerical_fields","``",",","and","``","target_field","``","are","not","provided","(","e.g",".","when","loading","data","for","inference","or","validation",")",".","train_list",":","The","data","to","use","when","training",".","val_list",":","The","data","to","use","when","validating",".","test_list",":","The","data","to","use","when","testing",".","predict_list",":","The","data","to","use","when","predicting",".","input_cls",":","The",":","class",":","`","~flash.core.data.io.input.Input","`","type","to","use","for","loading","the","data",".","transform",":","The",":","class",":","`","~flash.core.data.io.input_transform.InputTransform","`","type","to","use",".","transform_kwargs",":","Dict","of","keyword","arguments","to","be","provided","when","instantiating","the","transforms",".","data_module_kwargs",":","Additional","keyword","arguments","to","provide","to","the",":","class",":","`","~flash.core.data.data_module.DataModule","`","constructor",".","Returns",":","The","constructed",":","class",":","`","~flash.tabular.regression.data.TabularRegressionData","`",".","Examples","________","..","testsetup",":",":",">",">",">","train_data","=","[","...","{","``","age","''",":","2",",","``","animal","''",":","``","cat","''",",","``","weight","''",":","6","}",",","...","{","``","age","''",":","4",",","``","animal","''",":","``","dog","''",",","``","weight","''",":","10","}",",","...","{","``","age","''",":","1",",","``","animal","''",":","``","cat","''",",","``","weight","''",":","5","}",",","...","]",">",">",">","predict_data","=","[","...","{","``","animal","''",":","``","dog","''",",","``","weight","''",":","7","}",",","...","{","``","animal","''",":","``","dog","''",",","``","weight","''",":","12","}",",","...","{","``","animal","''",":","``","cat","''",",","``","weight","''",":","5","}",",","...","]","We","have","a","list","of","dictionaries","``","train_data","``","with","the","following","contents",":","..","code-block",":",":","[","{","``","age","''",":","2",",","animal","''",":","``","cat","''",",","``","weight","''",":","6","}",",","{","``","age","''",":","4",",","animal","''",":","``","dog","''",",","``","weight","''",":","10","}",",","{","``","age","''",":","1",",","animal","''",":","``","cat","''",",","``","weight","''",":","5","}",",","]","and","a","list","of","dictionaries","``","predict_data","``","with","the","following","contents",":","..","code-block",":",":","[","{","``","animal","''",":","``","dog","''",",","``","weight","''",":","7","}",",","{","``","animal","''",":","``","dog","''",",","``","weight","''",":","12","}",",","{","``","animal","''",":","``","cat","''",",","``","weight","''",":","5","}",",","]","..","doctest",":",":",">",">",">","from","flash","import","Trainer",">",">",">","from","flash.tabular","import","TabularRegressor",",","TabularRegressionData",">",">",">","datamodule","=","TabularRegressionData.from_lists","(","...","``","animal","''",",","...","``","weight","''",",","...","``","age","''",",","...","train_list=train_data",",","...","predict_list=predict_data",",","...","batch_size=4",",","...",")",">",">",">","model","=","TabularRegressor.from_data","(","datamodule",",","backbone=","''","tabnet","''",")",">",">",">","trainer","=","Trainer","(","fast_dev_run=True",")",">",">",">","trainer.fit","(","model",",","datamodule=datamodule",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE","Training","...",">",">",">","trainer.predict","(","model",",","datamodule=datamodule",")","#","doctest",":","+ELLIPSIS","+NORMALIZE_WHITESPACE","Predicting","...","..","testcleanup",":",":",">",">",">","del","train_data",">",">",">","del","predict_data"]
code: def from_lists(
      cls,
      categorical_fields: Optional[Union[str, List[str]]] = None,
      numerical_fields: Optional[Union[str, List[str]]] = None,
      target_field: Optional[str] = None,
      parameters: Optional[Dict[str, Any]] = None,
      train_list: List[Union[tuple, dict]] = None,
      val_list: List[Union[tuple, dict]] = None,
      test_list: List[Union[tuple, dict]] = None,
      predict_list: List[Union[tuple, dict]] = None,
      input_cls: Type[Input] = TabularRegressionListInput,
      transform: INPUT_TRANSFORM_TYPE = InputTransform,
      transform_kwargs: Optional[Dict] = None,
      **data_module_kwargs: Any,
  ) -> "TabularRegressionData":
      """Creates a :class:`~flash.tabular.regression.data.TabularRegressionData` object from the given data (in the
      form of list of a tuple or a dictionary).
  
      .. note::
  
          The ``categorical_fields``, ``numerical_fields``, and ``target_field`` do not need to be provided if
          ``parameters`` are passed instead. These can be obtained from the
          :attr:`~flash.tabular.data.TabularData.parameters` attribute of the
          :class:`~flash.tabular.data.TabularData` object that contains your training data.
  
      The targets will be extracted from the ``target_field`` in the data frames.
      To learn how to customize the transforms applied for each stage, read our
      :ref:`customizing transforms guide <customizing_transforms>`.
  
      Args:
          categorical_fields: The fields (column names) in the dictionary containing categorical data.
          numerical_fields: The fields (column names) in the dictionary containing numerical data.
          target_field: The field (column name) in the dictionary containing the targets.
          parameters: Parameters to use if ``categorical_fields``, ``numerical_fields``, and ``target_field`` are not
              provided (e.g. when loading data for inference or validation).
          train_list: The data to use when training.
          val_list: The data to use when validating.
          test_list: The data to use when testing.
          predict_list: The data to use when predicting.
          input_cls: The :class:`~flash.core.data.io.input.Input` type to use for loading the data.
          transform: The :class:`~flash.core.data.io.input_transform.InputTransform` type to use.
          transform_kwargs: Dict of keyword arguments to be provided when instantiating the transforms.
          data_module_kwargs: Additional keyword arguments to provide to the
            :class:`~flash.core.data.data_module.DataModule` constructor.
  
      Returns:
          The constructed :class:`~flash.tabular.regression.data.TabularRegressionData`.
  
      Examples
      ________
  
      .. testsetup::
  
          >>> train_data = [
          ...     {"age": 2, "animal": "cat", "weight": 6},
          ...     {"age": 4, "animal": "dog", "weight": 10},
          ...     {"age": 1, "animal": "cat", "weight": 5},
          ... ]
          >>> predict_data = [
          ...     {"animal": "dog", "weight": 7},
          ...     {"animal": "dog", "weight": 12},
          ...     {"animal": "cat", "weight": 5},
          ... ]
  
      We have a list of dictionaries ``train_data`` with the following contents:
  
      .. code-block::
  
          [
              {"age": 2, animal": "cat", "weight": 6},
              {"age": 4, animal": "dog", "weight": 10},
              {"age": 1, animal": "cat", "weight": 5},
          ]
  
      and a list of dictionaries ``predict_data`` with the following contents:
  
      .. code-block::
  
          [
              {"animal": "dog", "weight": 7},
              {"animal": "dog", "weight": 12},
              {"animal": "cat", "weight": 5},
          ]
  
      .. doctest::
  
          >>> from flash import Trainer
          >>> from flash.tabular import TabularRegressor, TabularRegressionData
          >>> datamodule = TabularRegressionData.from_lists(
          ...     "animal",
          ...     "weight",
          ...     "age",
          ...     train_list=train_data,
          ...     predict_list=predict_data,
          ...     batch_size=4,
          ... )
          >>> model = TabularRegressor.from_data(datamodule, backbone="tabnet")
          >>> trainer = Trainer(fast_dev_run=True)
          >>> trainer.fit(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
          Training...
          >>> trainer.predict(model, datamodule=datamodule)  # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
          Predicting...
  
      .. testcleanup::
  
          >>> del train_data
          >>> del predict_data
  
      """
      ds_kw = {
          "categorical_fields": categorical_fields,
          "numerical_fields": numerical_fields,
          "target_field": target_field,
          "parameters": parameters,
      }
  
      train_input = input_cls(
          RunningStage.TRAINING, train_list, **ds_kw
      )
      ds_kw["parameters"] = (
          train_input.parameters if train_input else parameters
      )
  
      return cls(
          train_input,
          input_cls(RunningStage.VALIDATING, val_list, **ds_kw),
          input_cls(RunningStage.TESTING, test_list, **ds_kw),
          input_cls(RunningStage.PREDICTING, predict_list, **ds_kw),
          transform=transform,
          transform_kwargs=transform_kwargs,
          **data_module_kwargs,
      )
  
file_path: lightning-flash/src/flash/tabular/regression/data.py
imports: from typing import Any, Dict, List, Optional, Type, Union
  from flash.core.data.io.input import Input
  from flash.core.data.io.input_transform import INPUT_TRANSFORM_TYPE, InputTransform
  from flash.core.utilities.imports import _PANDAS_AVAILABLE, _TOPIC_TABULAR_AVAILABLE
  from flash.core.utilities.stages import RunningStage
  from flash.tabular.data import TabularData
  from flash.tabular.regression.input import TabularRegressionCSVInput, TabularRegressionDataFrameInput, TabularRegressionDictInput, TabularRegressionListInput
label_desc: Use image node_id 4 for calling the TabularRegressionData obj's underlying member method code with example usage: obj.from_lists(cls, categorical_fields, numerical_fields, target_field, parameters, train_list, val_list, test_list, predict_list, input_cls, transform, transform_kwargs) and returns: cls