class_docstr: To create our :class:`~flash.core.data.data_module.DataModule` we first set the ``input_transform_cls``
  attribute.
  
  Next, we add a ``from_numpy`` method and a ``from_sklearn`` method. Finally, we define the ``num_features`` property
  for convenience.
docstr: This is our custom ``from_*`` method. It expects scikit-learn ``Bunch`` objects as input and creates the
  ``TemplateData`` with them.
  
  Args:
      train_bunch: The scikit-learn ``Bunch`` containing the train data.
      val_bunch: The scikit-learn ``Bunch`` containing the validation data.
      test_bunch: The scikit-learn ``Bunch`` containing the test data.
      predict_bunch: The scikit-learn ``Bunch`` containing the predict data.
      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 data module.
docstr_tok: ["This","is","our","custom","``","from_","*","``","method",".","It","expects","scikit-learn","``","Bunch","``","objects","as","input","and","creates","the","``","TemplateData","``","with","them",".","Args",":","train_bunch",":","The","scikit-learn","``","Bunch","``","containing","the","train","data",".","val_bunch",":","The","scikit-learn","``","Bunch","``","containing","the","validation","data",".","test_bunch",":","The","scikit-learn","``","Bunch","``","containing","the","test","data",".","predict_bunch",":","The","scikit-learn","``","Bunch","``","containing","the","predict","data",".","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","data","module","."]
code: def from_sklearn(
      cls,
      train_bunch: Optional[Bunch] = None,
      val_bunch: Optional[Bunch] = None,
      test_bunch: Optional[Bunch] = None,
      predict_bunch: Optional[Bunch] = None,
      input_cls: Type[Input] = TemplateSKLearnClassificationInput,
      transform: INPUT_TRANSFORM_TYPE = TemplateInputTransform,
      transform_kwargs: Optional[Dict] = None,
      **data_module_kwargs: Any,
  ) -> "TemplateData":
      """This is our custom ``from_*`` method. It expects scikit-learn ``Bunch`` objects as input and creates the
      ``TemplateData`` with them.
  
      Args:
          train_bunch: The scikit-learn ``Bunch`` containing the train data.
          val_bunch: The scikit-learn ``Bunch`` containing the validation data.
          test_bunch: The scikit-learn ``Bunch`` containing the test data.
          predict_bunch: The scikit-learn ``Bunch`` containing the predict data.
          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 data module.
  
      """
      ds_kw = {}
  
      train_input = input_cls(
          RunningStage.TRAINING, train_bunch, **ds_kw
      )
      target_formatter = getattr(train_input, "target_formatter", None)
  
      return cls(
          train_input,
          input_cls(
              RunningStage.VALIDATING,
              val_bunch,
              target_formatter=target_formatter,
              **ds_kw,
          ),
          input_cls(
              RunningStage.TESTING,
              test_bunch,
              target_formatter=target_formatter,
              **ds_kw,
          ),
          input_cls(RunningStage.PREDICTING, predict_bunch, **ds_kw),
          transform=transform,
          transform_kwargs=transform_kwargs,
          **data_module_kwargs,
      )
  
imports: from typing import Any, Callable, Collection, Dict, List, Optional, Sequence, Tuple, Type
  import numpy
  import torch
  from flash.core.data.base_viz import BaseVisualization
  from flash.core.data.callback import BaseDataFetcher
  from flash.core.data.data_module import DataModule
  from flash.core.data.io.classification_input import ClassificationInputMixin
  from flash.core.data.io.input import DataKeys, Input
  from flash.core.data.io.input_transform import InputTransform
  from flash.core.data.utilities.classification import TargetFormatter
  from flash.core.data.utilities.samples import to_samples
  from flash.core.utilities.imports import _SKLEARN_AVAILABLE
  from flash.core.utilities.stages import RunningStage
  from flash.core.utilities.types import INPUT_TRANSFORM_TYPE
label_desc: Use image node_id 2 for calling the TemplateData obj's underlying member method code with example usage: obj.from_sklearn(cls, train_bunch, val_bunch, test_bunch, predict_bunch, input_cls, transform, transform_kwargs) and returns: cls