class_docstr: An abstract base class for user defined Transformers.
  
  **Overview**
  
  A Transformer is a stateful object that transforms input data (as an
  SFrame) from one form to another. Transformers are commonly used for
  feature engineering. In addition to the modules provided in Turi
  Create, users can extend the following class and write transformers that
  integrate seamlessly with the already existing ones.
  
  **Defining Custom Transformers**
  
  Each transformer object is one must have the following methods:
  
      +---------------+---------------------------------------------------+
      |   Method      | Description                                       |
      +===============+===================================================+
      | __init__      | Construct the object.                             |
      +---------------+---------------------------------------------------+
      | fit           | Fit the object using training data.               |
      +---------------+---------------------------------------------------+
      | transform     | Transform the object on training/test data.       |
      +---------------+---------------------------------------------------+
  
  In addition to these methods, there are convenience methods with default
  implementations:
  
      +---------------+---------------------------------------------------+
      |   Method      | Description                                       |
      +===============+===================================================+
      | fit_transform | First perform fit() and then transform() on data. |
      +---------------+---------------------------------------------------+
  
  See Also
  --------
  :class:`turicreate.toolkits.feature_engineering.TransformerChain`,
  :func:`turicreate.toolkits.feature_engineering.create`
  
  Notes
  ------
  - User defined Transformers behave identically to those that are already
    provided. They can be saved/loaded both locally and remotely, can
    be chained together, and can be deployed as components of predictive
    services.
  
  Examples
  --------
  
  In this example, we will write a simple Transformer that will subtract
  (for each column) the mean value observed during the `fit` stage.
  
  .. sourcecode:: python
  
      import turicreate
      from . import TransformerBase
  
      class MyTransformer(TransformerBase):
  
          def __init__(self):
              pass
  
          def fit(self, dataset):
              ''' Learn means during the fit stage.'''
              self.mean = {}
              for col in dataset.column_names():
                  self.mean[col] = dataset[col].mean()
              return self
  
          def transform(self, dataset):
              ''' Subtract means during the transform stage.'''
              new_dataset = turicreate.SFrame()
              for col in dataset.column_names():
                  new_dataset[col] = dataset[col] - self.mean[col]
              return new_dataset
  
      # Create the model
      model = tc.feature_engineering.create(dataset, MyTransformer())
  
      # Transform new data
      transformed_sf = model.transform(sf)
  
      # Save and load this model.
      model.save('foo-bar')
      loaded_model = turicreate.load_model('foo-bar')
class_docstr_tok: ["An","abstract","base","class","for","user","defined","Transformers",".","*","*","Overview","*","*","A","Transformer","is","a","stateful","object","that","transforms","input","data","(","as","an","SFrame",")","from","one","form","to","another",".","Transformers","are","commonly","used","for","feature","engineering",".","In","addition","to","the","modules","provided","in","Turi","Create",",","users","can","extend","the","following","class","and","write","transformers","that","integrate","seamlessly","with","the","already","existing","ones",".","*","*","Defining","Custom","Transformers","*","*","Each","transformer","object","is","one","must","have","the","following","methods",":","+","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","Method","|","Description","|","+===============+===================================================+","|","__init__","|","Construct","the","object",".","|","+","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","fit","|","Fit","the","object","using","training","data",".","|","+","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","transform","|","Transform","the","object","on","training\/test","data",".","|","+","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","In","addition","to","these","methods",",","there","are","convenience","methods","with","default","implementations",":","+","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","|","Method","|","Description","|","+===============+===================================================+","|","fit_transform","|","First","perform","fit","(",")","and","then","transform","(",")","on","data",".","|","+","--","--","--","--","--","--","--","-+","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-+","See","Also","--","--","--","--",":","class",":","`","turicreate.toolkits.feature_engineering.TransformerChain","`",",",":","func",":","`","turicreate.toolkits.feature_engineering.create","`","Notes","--","--","--","-","User","defined","Transformers","behave","identically","to","those","that","are","already","provided",".","They","can","be","saved\/loaded","both","locally","and","remotely",",","can","be","chained","together",",","and","can","be","deployed","as","components","of","predictive","services",".","Examples","--","--","--","--","In","this","example",",","we","will","write","a","simple","Transformer","that","will","subtract","(","for","each","column",")","the","mean","value","observed","during","the","`","fit","`","stage",".","..","sourcecode",":",":","python","import","turicreate","from",".","import","TransformerBase","class","MyTransformer","(","TransformerBase",")",":","def","__init__","(","self",")",":","pass","def","fit","(","self",",","dataset",")",":","``","'","Learn","means","during","the","fit","stage",".","''","'","self.mean","=","{","}","for","col","in","dataset.column_names","(",")",":","self.mean","[","col","]","=","dataset","[","col","]",".mean","(",")","return","self","def","transform","(","self",",","dataset",")",":","``","'","Subtract","means","during","the","transform","stage",".","''","'","new_dataset","=","turicreate.SFrame","(",")","for","col","in","dataset.column_names","(",")",":","new_dataset","[","col","]","=","dataset","[","col","]","-","self.mean","[","col","]","return","new_dataset","#","Create","the","model","model","=","tc.feature_engineering.create","(","dataset",",","MyTransformer","(",")",")","#","Transform","new","data","transformed_sf","=","model.transform","(","sf",")","#","Save","and","load","this","model",".","model.save","(","'foo-bar","'",")","loaded_model","=","turicreate.load_model","(","'foo-bar","'",")"]
code: def __repr__(self):
      (sections, section_titles) = self._get_summary_struct()
      return _toolkit_repr_print(
          self, sections, section_titles, width=20
      )
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate
  from turicreate.toolkits._internal_utils import _toolkit_repr_print, _precomputed_field, _raise_error_if_not_sframe
label_desc: Use image node_id 3 for calling the TransformerBase obj's underlying member method code with example usage: obj.__repr__() and returns: _toolkit_repr_print