class_docstr: Encodes any arbitrary string as a one-hot array.
  
  This featurizer uses the sklearn OneHotEncoder to create
  sparse matrix representation of a one-hot array of any string.
  It is expected to be used in large datasets that produces memory overload
  using standard featurizer such as OneHotFeaturizer. For example: SwissprotDataset
  
  
  Examples
  --------
  >>> import deepchem as dc
  >>> featurizer = dc.feat.SparseMatrixOneHotFeaturizer()
  >>> sequence = "MMMQLA"
  >>> encodings = featurizer.featurize([sequence])
  >>> encodings[0].shape
  (6, 25)
docstr: Initialize featurizer.
  
  Parameters
  ----------
  charset: List[str] (default code)
      A list of strings, where each string is length 1 and unique.
code: def __init__(self, charset: List[str] = CHARSET):
      """Initialize featurizer.
  
      Parameters
      ----------
      charset: List[str] (default code)
          A list of strings, where each string is length 1 and unique.
  
      """
      if len(charset) != len(set(charset)):
          raise ValueError("All values in charset must be unique.")
      self.charset = charset
      from sklearn.preprocessing import OneHotEncoder
  
      cat = np.array(self.charset).reshape(1, len(self.charset))
      self.ohe = OneHotEncoder(
          categories=list(cat), handle_unknown="ignore"
      )
  
file_path: deepchem/deepchem/feat/molecule_featurizers/sparse_matrix_one_hot_featurizer.py
imports: import logging
  from typing import List
  import numpy
  import scipy
  from deepchem.feat.base_classes import Featurizer
  from typing import Any, Iterable
label_desc: Use image node_id 1 to create a new SparseMatrixOneHotFeaturizer object from inherited base classes: Featurizer with example: obj = SparseMatrixOneHotFeaturizer(charset)