xenonpy.contrib.extend_descriptors.descriptor package

Submodules

xenonpy.contrib.extend_descriptors.descriptor.frozen_featurizer_descriptor module

class xenonpy.contrib.extend_descriptors.descriptor.frozen_featurizer_descriptor.FrozenFeaturizerDescriptor(descriptor_calculator, frozen_featurizer, *, on_errors='raise', return_type='any')[source]

Bases: BaseFeaturizer

A featurizer for extracting artificial descriptors from neural networks

Parameters:
  • descriptor_calculator (BaseFeaturizer or BaseDescriptor) – Convert input data into descriptors to keep consistency with the pre-trained model.

  • frozen_featurizer (FrozenFeaturizer) – Extracting artificial descriptors from neural networks

featurize(x, *, depth=1)[source]

Main featurizer function, which has to be implemented in any derived featurizer subclass.

Parameters:

x (depends on featurizer) – input data to featurize.

Returns:

any – one or more features.

Return type:

numpy.ndarray

property feature_labels

Generate attribute names. :returns: ([str]) attribute labels.

xenonpy.contrib.extend_descriptors.descriptor.mordred_descriptor module

class xenonpy.contrib.extend_descriptors.descriptor.mordred_descriptor.Mordred2DDescriptor(*, on_errors='raise', return_type='any')[source]

Bases: BaseFeaturizer

Parameters:
  • n_jobs – The number of jobs to run in parallel for both fit and predict. Set -1 to use all cpu cores (default). Inputs X will be split into some blocks then run on each cpu cores. When set to 0, input X will be treated as a block and pass to Featurizer.featurize directly. This default parallel implementation does not support pd.DataFrame input, so please make sure you set n_jobs=0 if the input will be pd.DataFrame.

  • on_errors – How to handle the exceptions in a feature calculations. Can be ‘nan’, ‘keep’, ‘raise’. When ‘nan’, return a column with np.nan. The length of column corresponding to the number of feature labs. When ‘keep’, return a column with exception objects. The default is ‘raise’ which will raise up the exception.

  • return_type – Specify the return type. Can be any, custom, array and df. array and df force return type to np.ndarray and pd.DataFrame respectively. If any or custom, the return type depends on multiple factors (see transform function). Default is any

  • target_col – Only relevant when input is pd.DataFrame, otherwise ignored. Specify a single column to be used for transformation. If None, all columns of the pd.DataFrame is used. Default is None.

  • parallel_verbose – The verbosity level: if non zero, progress messages are printed. Above 50, the output is sent to stdout. The frequency of the messages increases with the verbosity level. If it more than 10, all iterations are reported. Default 0.

featurize(x)[source]

Main featurizer function, which has to be implemented in any derived featurizer subclass.

Parameters:

x (depends on featurizer) – input data to featurize.

Returns:

any – one or more features.

Return type:

numpy.ndarray

property feature_labels

Generate attribute names. :returns: ([str]) attribute labels.

xenonpy.contrib.extend_descriptors.descriptor.organic_comp_descriptor module

class xenonpy.contrib.extend_descriptors.descriptor.organic_comp_descriptor.OrganicCompDescriptor(n_jobs=-1, *, featurizers='all', on_errors='raise', return_type='any')[source]

Bases: BaseFeaturizer

A featurizer for extracting XenonPy compositional descriptors from SMILES or MOL

featurize(x)[source]

Main featurizer function, which has to be implemented in any derived featurizer subclass.

Parameters:

x (depends on featurizer) – input data to featurize.

Returns:

any – one or more features.

Return type:

numpy.ndarray

property feature_labels

Generate attribute names. :returns: ([str]) attribute labels.

Module contents