class_docstr: RDKit descriptors.
  
  This class computes a list of chemical descriptors like
  molecular weight, number of valence electrons, maximum and
  minimum partial charge, etc using RDKit.
  
  This class can also compute normalized descriptors, if required.
  (The implementation for normalization is based on `RDKit2DNormalized()` method
  in 'descriptastorus' library.)
  
  When the `is_normalized` option is set as True, descriptor values are normalized across the sample
  by fitting a cumulative density function. CDFs were used as opposed to simpler scaling algorithms
  mainly because CDFs have the useful property that 'each value has the same meaning: the percentage
  of the population observed below the raw feature value.'
  
  Warning: Currently, the normalizing cdf parameters are not available for BCUT2D descriptors.
  (BCUT2D_MWHI, BCUT2D_MWLOW, BCUT2D_CHGHI, BCUT2D_CHGLO, BCUT2D_LOGPHI, BCUT2D_LOGPLOW, BCUT2D_MRHI, BCUT2D_MRLOW)
  
  Note
  ----
  This class requires RDKit to be installed.
  
  Examples
  --------
  >>> import deepchem as dc
  >>> smiles = ['CC(=O)OC1=CC=CC=C1C(=O)O']
  >>> featurizer = dc.feat.RDKitDescriptors()
  >>> features = featurizer.featurize(smiles)
  >>> type(features[0])
  <class 'numpy.ndarray'>
  >>> features[0].shape
  (210,)
class_docstr_tok: ["RDKit","descriptors",".","This","class","computes","a","list","of","chemical","descriptors","like","molecular","weight",",","number","of","valence","electrons",",","maximum","and","minimum","partial","charge",",","etc","using","RDKit",".","This","class","can","also","compute","normalized","descriptors",",","if","required",".","(","The","implementation","for","normalization","is","based","on","`","RDKit2DNormalized","(",")","`","method","in","'descriptastorus","'","library",".",")","When","the","`","is_normalized","`","option","is","set","as","True",",","descriptor","values","are","normalized","across","the","sample","by","fitting","a","cumulative","density","function",".","CDFs","were","used","as","opposed","to","simpler","scaling","algorithms","mainly","because","CDFs","have","the","useful","property","that","'each","value","has","the","same","meaning",":","the","percentage","of","the","population","observed","below","the","raw","feature","value",".","'","Warning",":","Currently",",","the","normalizing","cdf","parameters","are","not","available","for","BCUT2D","descriptors",".","(","BCUT2D_MWHI",",","BCUT2D_MWLOW",",","BCUT2D_CHGHI",",","BCUT2D_CHGLO",",","BCUT2D_LOGPHI",",","BCUT2D_LOGPLOW",",","BCUT2D_MRHI",",","BCUT2D_MRLOW",")","Note","--","--","This","class","requires","RDKit","to","be","installed",".","Examples","--","--","--","--",">",">",">","import","deepchem","as","dc",">",">",">","smiles","=","[","'CC","(","=O",")","OC1=CC=CC=C1C","(","=O",")","O","'","]",">",">",">","featurizer","=","dc.feat.RDKitDescriptors","(",")",">",">",">","features","=","featurizer.featurize","(","smiles",")",">",">",">","type","(","features","[","0","]",")","<","class","'numpy.ndarray","'",">",">",">",">","features","[","0","]",".shape","(","210",",",")"]
docstr: Initialize this featurizer.
  
  Parameters
  ----------
  descriptors: List[str] (default None)
      List of RDKit descriptors to compute properties. When None, computes values
  for descriptors which are chosen based on options set in other arguments.
  use_fragment: bool, optional (default True)
      If True, the return value includes the fragment binary descriptors like 'fr_XXX'.
  ipc_avg: bool, optional (default True)
      If True, the IPC descriptor calculates with avg=True option.
      Please see this issue: https://github.com/rdkit/rdkit/issues/1527.
  is_normalized: bool, optional (default False)
      If True, the return value contains normalized features.
  use_bcut2d: bool, optional (default True)
      If True, the return value includes the descriptors like 'BCUT2D_XXX'.
  labels_only: bool, optional (default False)
      Returns only the presence or absence of a group.
  
  Notes
  -----
  * If both `labels_only` and `is_normalized` are True, then `is_normalized` takes
      precendence and `labels_only` will not be applied.
docstr_tok: ["Initialize","this","featurizer",".","Parameters","--","--","--","--","--","descriptors",":","List","[","str","]","(","default","None",")","List","of","RDKit","descriptors","to","compute","properties",".","When","None",",","computes","values","for","descriptors","which","are","chosen","based","on","options","set","in","other","arguments",".","use_fragment",":","bool",",","optional","(","default","True",")","If","True",",","the","return","value","includes","the","fragment","binary","descriptors","like","'fr_XXX","'",".","ipc_avg",":","bool",",","optional","(","default","True",")","If","True",",","the","IPC","descriptor","calculates","with","avg=True","option",".","Please","see","this","issue",":","https",":","\/\/github.com\/rdkit\/rdkit\/issues\/1527",".","is_normalized",":","bool",",","optional","(","default","False",")","If","True",",","the","return","value","contains","normalized","features",".","use_bcut2d",":","bool",",","optional","(","default","True",")","If","True",",","the","return","value","includes","the","descriptors","like","'BCUT2D_XXX","'",".","labels_only",":","bool",",","optional","(","default","False",")","Returns","only","the","presence","or","absence","of","a","group",".","Notes","--","--","-","*","If","both","`","labels_only","`","and","`","is_normalized","`","are","True",",","then","`","is_normalized","`","takes","precendence","and","`","labels_only","`","will","not","be","applied","."]
code: def __init__(
      self,
      descriptors: List[str] = [],
      is_normalized: bool = False,
      use_fragment: bool = True,
      ipc_avg: bool = True,
      use_bcut2d: bool = True,
      labels_only: bool = False,
  ):
      """Initialize this featurizer.
  
      Parameters
      ----------
      descriptors: List[str] (default None)
          List of RDKit descriptors to compute properties. When None, computes values
      for descriptors which are chosen based on options set in other arguments.
      use_fragment: bool, optional (default True)
          If True, the return value includes the fragment binary descriptors like 'fr_XXX'.
      ipc_avg: bool, optional (default True)
          If True, the IPC descriptor calculates with avg=True option.
          Please see this issue: https://github.com/rdkit/rdkit/issues/1527.
      is_normalized: bool, optional (default False)
          If True, the return value contains normalized features.
      use_bcut2d: bool, optional (default True)
          If True, the return value includes the descriptors like 'BCUT2D_XXX'.
      labels_only: bool, optional (default False)
          Returns only the presence or absence of a group.
  
      Notes
      -----
      * If both `labels_only` and `is_normalized` are True, then `is_normalized` takes
          precendence and `labels_only` will not be applied.
  
      """
      try:
          from rdkit.Chem import Descriptors
      except ModuleNotFoundError:
          raise ImportError(
              "This class requires RDKit to be installed."
          )
  
      self.use_fragment: bool = use_fragment
      self.use_bcut2d: bool = use_bcut2d
      self.is_normalized: bool = is_normalized
      self.ipc_avg: bool = ipc_avg
      self.labels_only = labels_only
      self.reqd_properties = {}
      self.normalized_desc: Dict[str, Callable] = {}
  
      all_descriptors = {
          name: func for name, func in Descriptors.descList
      }
  
      if not descriptors:
          # user has not specified a descriptor list
          for desc_name, function in all_descriptors.items():
              if self.use_fragment is False and desc_name.startswith(
                  "fr_"
              ):
                  continue
              if self.use_bcut2d is False and desc_name.startswith(
                  "BCUT2D_"
              ):
                  continue
              self.reqd_properties[desc_name] = function
      else:
          for desc_name in descriptors:
              if desc_name in all_descriptors:
                  self.reqd_properties[desc_name] = all_descriptors[
                      desc_name
                  ]
              else:
                  logging.error(
                      "Unable to find specified property %s" % desc_name
                  )
  
      # creates normalized functions dictionary if normalized features are required
      if is_normalized:
          self.normalized_desc = self._make_normalised_func_dict()
          desc_names = list(self.reqd_properties.keys())
          for desc_name in desc_names:
              if desc_name not in self.normalized_desc:
                  logger.warning(
                      "No normalization for %s. Feature removed!",
                      desc_name,
                  )
                  self.reqd_properties.pop(desc_name)
  
      self.reqd_properties = dict(sorted(self.reqd_properties.items()))
  
file_path: deepchem/deepchem/feat/molecule_featurizers/rdkit_descriptors.py
imports: from typing import List, Sequence, Union, Callable, Dict
  import numpy
  import scipy.stats
  from scipy.stats import rv_continuous
  import logging
  from deepchem.utils.typing import RDKitMol
  from deepchem.feat.base_classes import MolecularFeaturizer
  from deepchem.utils.rdkit_utils import DescriptorsNormalizationParameters
label_desc: Use image node_id 1 to create a new RDKitDescriptors object from inherited base classes: MolecularFeaturizer with example: obj = RDKitDescriptors(descriptors, is_normalized, use_fragment, ipc_avg, use_bcut2d, labels_only)