class_docstr: Encode categorical integer features using a one-hot aka one-of-K scheme.
  
  The input to this transformer should be a matrix of integers, denoting
  the values taken on by categorical (discrete) features. The output will be
  a sparse matrix were each column corresponds to one possible value of one
  feature. It is assumed that input features take on values in the range
  [0, n_values).
  
  This encoding is needed for feeding categorical data to many scikit-learn
  estimators, notably linear models and SVMs with the standard kernels.
  
  Parameters
  ----------
  
  categorical_features: "all" or array of indices or mask
      Specify what features are treated as categorical.
  
      - 'all': All features are treated as categorical.
      - 'auto' (default): Select only features that have less than 10 unique values.
      - array of indices: Array of categorical feature indices.
      - mask: Array of length n_features and with dtype=bool.
  
      Non-categorical features are always stacked to the right of the matrix.
  
  dtype : number type, default=np.float64
      Desired dtype of output.
  
  sparse : boolean, default=True
      Will return sparse matrix if set True else will return an array.
  
  threshold : int, default=10
      Maximum number of unique values per feature to consider the feature
      to be categorical when categorical_features is 'auto'.
  
  minimum_fraction : float, default=None
      Minimum fraction of unique values in a feature to consider the feature
      to be categorical.
  
  Attributes
  ----------
  `active_features_` : array
      Indices for active features, meaning values that actually occur
      in the training set. Only available when n_values is ``'auto'``.
  
  `feature_indices_` : array of shape (n_features,)
      Indices to feature ranges.
      Feature ``i`` in the original data is mapped to features
      from ``feature_indices_[i]`` to ``feature_indices_[i+1]``
      (and then potentially masked by `active_features_` afterwards)
  
  `n_values_` : array of shape (n_features,)
      Maximum number of values per feature.
  
  Examples
  --------
  Given a dataset with three features and two samples, we let the encoder
  find the maximum value per feature and transform the data to a binary
  one-hot encoding.
  
  >>> from sklearn.preprocessing import OneHotEncoder
  >>> enc = OneHotEncoder()
  >>> enc.fit([[0, 0, 3], [1, 1, 0], [0, 2, 1], [1, 0, 2]])  # doctest: +ELLIPSIS
  OneHotEncoder(categorical_features='all', dtype=<... 'float'>,
         sparse=True, minimum_fraction=None)
  >>> enc.n_values_
  array([2, 3, 4])
  >>> enc.feature_indices_
  array([0, 2, 5, 9])
  >>> enc.transform([[0, 1, 1]]).toarray()
  array([[ 1.,  0.,  0.,  1.,  0.,  0.,  1.,  0.,  0.]])
  
  See also
  --------
  sklearn.feature_extraction.DictVectorizer : performs a one-hot encoding of
    dictionary items (also handles string-valued features).
  sklearn.feature_extraction.FeatureHasher : performs an approximate one-hot
    encoding of dictionary items or strings.
class_docstr_tok: ["Encode","categorical","integer","features","using","a","one-hot","aka","one-of-K","scheme",".","The","input","to","this","transformer","should","be","a","matrix","of","integers",",","denoting","the","values","taken","on","by","categorical","(","discrete",")","features",".","The","output","will","be","a","sparse","matrix","were","each","column","corresponds","to","one","possible","value","of","one","feature",".","It","is","assumed","that","input","features","take","on","values","in","the","range","[","0",",","n_values",")",".","This","encoding","is","needed","for","feeding","categorical","data","to","many","scikit-learn","estimators",",","notably","linear","models","and","SVMs","with","the","standard","kernels",".","Parameters","--","--","--","--","--","categorical_features",":","``","all","''","or","array","of","indices","or","mask","Specify","what","features","are","treated","as","categorical",".","-","'all","'",":","All","features","are","treated","as","categorical",".","-","'auto","'","(","default",")",":","Select","only","features","that","have","less","than","10","unique","values",".","-","array","of","indices",":","Array","of","categorical","feature","indices",".","-","mask",":","Array","of","length","n_features","and","with","dtype=bool",".","Non-categorical","features","are","always","stacked","to","the","right","of","the","matrix",".","dtype",":","number","type",",","default=np.float64","Desired","dtype","of","output",".","sparse",":","boolean",",","default=True","Will","return","sparse","matrix","if","set","True","else","will","return","an","array",".","threshold",":","int",",","default=10","Maximum","number","of","unique","values","per","feature","to","consider","the","feature","to","be","categorical","when","categorical_features","is","'auto","'",".","minimum_fraction",":","float",",","default=None","Minimum","fraction","of","unique","values","in","a","feature","to","consider","the","feature","to","be","categorical",".","Attributes","--","--","--","--","--","`","active_features_","`",":","array","Indices","for","active","features",",","meaning","values","that","actually","occur","in","the","training","set",".","Only","available","when","n_values","is","``","'auto","'","``",".","`","feature_indices_","`",":","array","of","shape","(","n_features",",",")","Indices","to","feature","ranges",".","Feature","``","i","``","in","the","original","data","is","mapped","to","features","from","``","feature_indices_","[","i","]","``","to","``","feature_indices_","[","i+1","]","``","(","and","then","potentially","masked","by","`","active_features_","`","afterwards",")","`","n_values_","`",":","array","of","shape","(","n_features",",",")","Maximum","number","of","values","per","feature",".","Examples","--","--","--","--","Given","a","dataset","with","three","features","and","two","samples",",","we","let","the","encoder","find","the","maximum","value","per","feature","and","transform","the","data","to","a","binary","one-hot","encoding",".",">",">",">","from","sklearn.preprocessing","import","OneHotEncoder",">",">",">","enc","=","OneHotEncoder","(",")",">",">",">","enc.fit","(","[","[","0",",","0",",","3","]",",","[","1",",","1",",","0","]",",","[","0",",","2",",","1","]",",","[","1",",","0",",","2","]","]",")","#","doctest",":","+ELLIPSIS","OneHotEncoder","(","categorical_features='all","'",",","dtype=","<","...","'float","'",">",",","sparse=True",",","minimum_fraction=None",")",">",">",">","enc.n_values_","array","(","[","2",",","3",",","4","]",")",">",">",">","enc.feature_indices_","array","(","[","0",",","2",",","5",",","9","]",")",">",">",">","enc.transform","(","[","[","0",",","1",",","1","]","]",")",".toarray","(",")","array","(","[","[","1.",",","0.",",","0.",",","1.",",","0.",",","0.",",","1.",",","0.",",","0",".","]","]",")","See","also","--","--","--","--","sklearn.feature_extraction.DictVectorizer",":","performs","a","one-hot","encoding","of","dictionary","items","(","also","handles","string-valued","features",")",".","sklearn.feature_extraction.FeatureHasher",":","performs","an","approximate","one-hot","encoding","of","dictionary","items","or","strings","."]
docstr: Adjust all values in X to encode for NaNs and infinities in the data.
  
  Parameters
  ----------
  X : array-like, shape=(n_samples, n_feature)
      Input array of type int.
  
  Returns
  -------
  X : array-like, shape=(n_samples, n_feature)
      Input array without any NaNs or infinities.
docstr_tok: ["Adjust","all","values","in","X","to","encode","for","NaNs","and","infinities","in","the","data",".","Parameters","--","--","--","--","--","X",":","array-like",",","shape=","(","n_samples",",","n_feature",")","Input","array","of","type","int",".","Returns","--","--","--","-","X",":","array-like",",","shape=","(","n_samples",",","n_feature",")","Input","array","without","any","NaNs","or","infinities","."]
code: def _matrix_adjust(self, X):
      """Adjust all values in X to encode for NaNs and infinities in the data.
  
      Parameters
      ----------
      X : array-like, shape=(n_samples, n_feature)
          Input array of type int.
  
      Returns
      -------
      X : array-like, shape=(n_samples, n_feature)
          Input array without any NaNs or infinities.
      """
      data_matrix = X.data if sparse.issparse(X) else X
  
      # Shift all values to specially encode for NAN/infinity/OTHER and 0
      #   Old value       New Value
      #   ---------       ---------
      #   N (0..int_max)  N + 3
      #   np.NaN          2
      #   infinity        2
      #   *other*         1
      #
      # A value of 0 is reserved, as that is specially handled in sparse
      # matrices.
      data_matrix += len(SPARSE_ENCODINGS) + 1
      data_matrix[~np.isfinite(data_matrix)] = SPARSE_ENCODINGS["NAN"]
  
      return X
  
file_path: tpot/tpot/builtins/one_hot_encoder.py
imports: import numpy
  from scipy import sparse
  from sklearn.base import BaseEstimator, TransformerMixin
  from sklearn.utils import check_array
label_desc: Use image node_id 3 for calling the OneHotEncoder obj's underlying member method code with example usage: obj._matrix_adjust(X) and returns: X