class_docstr: A default Linear Classifier based on sklearn's SGDClassifier for
  learning decision boundaries between concepts.
  Note that default implementation slices input dataset into train and test
  splits and keeps them in memory.
  In case concept datasets are large, this can lead to out of memory and we
  recommend to provide a custom Classier that extends `Classifier` abstract
  class and handles large concept datasets accordingly.
class_docstr_tok: ["A","default","Linear","Classifier","based","on","sklearn","'s","SGDClassifier","for","learning","decision","boundaries","between","concepts",".","Note","that","default","implementation","slices","input","dataset","into","train","and","test","splits","and","keeps","them","in","memory",".","In","case","concept","datasets","are","large",",","this","can","lead","to","out","of","memory","and","we","recommend","to","provide","a","custom","Classier","that","extends","`","Classifier","`","abstract","class","and","handles","large","concept","datasets","accordingly","."]
docstr:  Implements Classifier::train_and_eval abstract method for small concept
   datsets provided by `dataloader`.
   It is assumed that when iterating over `dataloader` we can still
   retain the entire dataset in the memory.
   This method shuffles all examples randomly provided, splits them
   into train and test partitions and trains an SGDClassifier using sklearn
   library. Ultimately, it measures and returns model accuracy using test
   split of the dataset.
  
  Args:
      dataloader (dataloader): A dataloader that enables batch-wise access to
              the inputs and corresponding labels. Dataloader allows us to
              iterate over the dataset by loading the batches in lazy manner.
      test_split_ratio (float): The ratio of test split in the entire dataset
              served by input data loader `dataloader`.
  
              Default: 0.33
  Returns:
      stats (dict): a dictionary of statistics about the performance of the model.
              In this case stats represents a dictionary of model accuracy
              measured on the test split of the dataset.
docstr_tok: ["Implements","Classifier",":",":train_and_eval","abstract","method","for","small","concept","datsets","provided","by","`","dataloader","`",".","It","is","assumed","that","when","iterating","over","`","dataloader","`","we","can","still","retain","the","entire","dataset","in","the","memory",".","This","method","shuffles","all","examples","randomly","provided",",","splits","them","into","train","and","test","partitions","and","trains","an","SGDClassifier","using","sklearn","library",".","Ultimately",",","it","measures","and","returns","model","accuracy","using","test","split","of","the","dataset",".","Args",":","dataloader","(","dataloader",")",":","A","dataloader","that","enables","batch-wise","access","to","the","inputs","and","corresponding","labels",".","Dataloader","allows","us","to","iterate","over","the","dataset","by","loading","the","batches","in","lazy","manner",".","test_split_ratio","(","float",")",":","The","ratio","of","test","split","in","the","entire","dataset","served","by","input","data","loader","`","dataloader","`",".","Default",":","0.33","Returns",":","stats","(","dict",")",":","a","dictionary","of","statistics","about","the","performance","of","the","model",".","In","this","case","stats","represents","a","dictionary","of","model","accuracy","measured","on","the","test","split","of","the","dataset","."]
code: def train_and_eval(
      self,
      dataloader: DataLoader,
      test_split_ratio: float = 0.33,
      **kwargs: Any,
  ) -> Union[Dict, None]:
      r"""
       Implements Classifier::train_and_eval abstract method for small concept
       datsets provided by `dataloader`.
       It is assumed that when iterating over `dataloader` we can still
       retain the entire dataset in the memory.
       This method shuffles all examples randomly provided, splits them
       into train and test partitions and trains an SGDClassifier using sklearn
       library. Ultimately, it measures and returns model accuracy using test
       split of the dataset.
  
      Args:
          dataloader (dataloader): A dataloader that enables batch-wise access to
                  the inputs and corresponding labels. Dataloader allows us to
                  iterate over the dataset by loading the batches in lazy manner.
          test_split_ratio (float): The ratio of test split in the entire dataset
                  served by input data loader `dataloader`.
  
                  Default: 0.33
      Returns:
          stats (dict): a dictionary of statistics about the performance of the model.
                  In this case stats represents a dictionary of model accuracy
                  measured on the test split of the dataset.
  
      """
      inputs = []
      labels = []
      for input, label in dataloader:
          inputs.append(input)
          labels.append(label)
  
      device = "cpu" if input is None else input.device
      x_train, x_test, y_train, y_test = _train_test_split(
          torch.cat(inputs),
          torch.cat(labels),
          test_split=test_split_ratio,
      )
      self.lm.device = device
      self.lm.fit(DataLoader(TensorDataset(x_train, y_train)))
  
      predict = self.lm(x_test)
  
      predict = self.lm.classes()[torch.argmax(predict, dim=1)]  # type: ignore
      score = predict.long() == y_test.long().cpu()
  
      accs = score.float().mean()
  
      return {"accs": accs}
  
imports: import random
  import warnings
  from abc import ABC, abstractmethod
  from typing import Any, Dict, List, Tuple, Union
  import torch
  from captum._utils.models.linear_model import model
  from torch import Tensor
  from torch.utils.data import DataLoader, TensorDataset
label_desc: Use image node_id 2 for calling the DefaultClassifier obj's underlying member method code with example usage: obj.train_and_eval(dataloader, test_split_ratio) and returns: dict