class_docstr: Abstract class for calculating a set of features for an
  inorganic crystal composition.
  
  The defining feature of a `MaterialCompositionFeaturizer` is that it
  operates on 3D crystal chemical compositions.
  Inorganic crystal compositions are represented by Pymatgen composition
  objects. Featurizers for inorganic crystal compositions that are
  subclasses of this class should plan to process input which comes as
  Pymatgen composition objects.
  
  This class is abstract and cannot be invoked directly. You'll
  likely only interact with this class if you're a developer. Child
  classes need to implement the _featurize method for calculating
  features for a single crystal composition.
  
  Note
  ----
  Some subclasses of this class will require pymatgen and matminer to be
  installed.
class_docstr_tok: ["Abstract","class","for","calculating","a","set","of","features","for","an","inorganic","crystal","composition",".","The","defining","feature","of","a","`","MaterialCompositionFeaturizer","`","is","that","it","operates","on","3D","crystal","chemical","compositions",".","Inorganic","crystal","compositions","are","represented","by","Pymatgen","composition","objects",".","Featurizers","for","inorganic","crystal","compositions","that","are","subclasses","of","this","class","should","plan","to","process","input","which","comes","as","Pymatgen","composition","objects",".","This","class","is","abstract","and","can","not","be","invoked","directly",".","You'll","likely","only","interact","with","this","class","if","you","'re","a","developer",".","Child","classes","need","to","implement","the","_featurize","method","for","calculating","features","for","a","single","crystal","composition",".","Note","--","--","Some","subclasses","of","this","class","will","require","pymatgen","and","matminer","to","be","installed","."]
docstr: Calculate features for crystal compositions.
  
  Parameters
  ----------
  datapoints: Iterable[str]
      Iterable sequence of composition strings, e.g. "MoS2".
  log_every_n: int, default 1000
      Logging messages reported every `log_every_n` samples.
  
  Returns
  -------
  features: np.ndarray
      A numpy array containing a featurized representation of
      `compositions`.
docstr_tok: ["Calculate","features","for","crystal","compositions",".","Parameters","--","--","--","--","--","datapoints",":","Iterable","[","str","]","Iterable","sequence","of","composition","strings",",","e.g",".","``","MoS2","''",".","log_every_n",":","int",",","default","1000","Logging","messages","reported","every","`","log_every_n","`","samples",".","Returns","--","--","--","-","features",":","np.ndarray","A","numpy","array","containing","a","featurized","representation","of","`","compositions","`","."]
code: def featurize(
      self,
      datapoints: Optional[Iterable[str]] = None,
      log_every_n: int = 1000,
      **kwargs,
  ) -> np.ndarray:
      """Calculate features for crystal compositions.
  
      Parameters
      ----------
      datapoints: Iterable[str]
          Iterable sequence of composition strings, e.g. "MoS2".
      log_every_n: int, default 1000
          Logging messages reported every `log_every_n` samples.
  
      Returns
      -------
      features: np.ndarray
          A numpy array containing a featurized representation of
          `compositions`.
      """
      try:
          from pymatgen.core import Composition
      except ModuleNotFoundError:
          raise ImportError(
              "This class requires pymatgen to be installed."
          )
  
      if "compositions" in kwargs and datapoints is None:
          datapoints = kwargs.get("compositions")
          raise DeprecationWarning(
              'Compositions is being phased out as a parameter, please pass "datapoints" instead.'
          )
  
      if not isinstance(datapoints, Iterable):
          datapoints = [cast(str, datapoints)]
  
      datapoints = list(datapoints)
      features = []
      for idx, composition in enumerate(datapoints):
          if idx % log_every_n == 0:
              logger.info("Featurizing datapoint %i" % idx)
          try:
              c = Composition(composition)
              features.append(self._featurize(c, **kwargs))
          except:
              logger.warning(
                  "Failed to featurize datapoint %i. Appending empty array"
                  % idx
              )
              features.append(np.array([]))
  
      return np.asarray(features)
  
imports: import inspect
  import logging
  import numpy
  from typing import Any, Dict, Iterable, Optional, Tuple, Union, cast
  from deepchem.utils import get_print_threshold
  from deepchem.utils.typing import PymatgenStructure
label_desc: Use image node_id 1 for calling the MaterialCompositionFeaturizer obj's underlying member method code with example usage: obj.featurize(datapoints, log_every_n) and returns: np