Fitness¶
This module contains various fitness evaluation functions used in the illumination library.
Fingerprint Fitness¶
- class illumination.functions.fitness.Fingerprint_Fitness(config)[source]¶
Bases:
object
A strategy class for calculating the fitness of a molecule based on its fingerprint similarity to a target molecule.
- Attributes:
fingerprint_type: The type of fingerprint representation used (e.g., ECFP4, ECFP6, FCFP4, FCFP6). target: The target molecule as an RDKit Mol object. target_fingerprint: The fingerprint of the target molecule.
- Methods:
__init__: Initializes the Fingerprint_Fitness object with the specified configuration. __call__: Updates the fitness value of a molecule based on its fingerprint similarity to the target molecule. get_fingerprint: Retrieves the fingerprint of a molecular graph based on the specified fingerprint type. get_ECFP4: Generates the ECFP4 fingerprint for a molecular graph. get_ECFP6: Generates the ECFP6 fingerprint for a molecular graph. get_FCFP4: Generates the FCFP4 fingerprint for a molecular graph. get_FCFP6: Generates the FCFP6 fingerprint for a molecular graph.
- get_ECFP4(molecular_graph: Mol)[source]¶
Generates the ECFP4 fingerprint for a molecular graph.
- Args:
molecular_graph: The RDKit Mol object representing the molecule.
- Returns:
The ECFP4 fingerprint of the molecular graph.
- get_ECFP6(molecular_graph: Mol)[source]¶
Generates the ECFP6 fingerprint for a molecular graph.
- Args:
molecular_graph: The RDKit Mol object representing the molecule.
- Returns:
The ECFP6 fingerprint of the molecular graph.
- get_FCFP4(molecular_graph: Mol)[source]¶
Generates the FCFP4 fingerprint for a molecular graph.
- Args:
molecular_graph: The RDKit Mol object representing the molecule.
- Returns:
The FCFP4 fingerprint of the molecular graph.
- get_FCFP6(molecular_graph: Mol)[source]¶
Generates the FCFP6 fingerprint for a molecular graph.
- Args:
molecular_graph: The RDKit Mol object representing the molecule.
- Returns:
The FCFP6 fingerprint of the molecular graph.
- get_fingerprint(molecular_graph: Mol, fingerprint_type: str)[source]¶
Retrieves the fingerprint of a molecular graph based on the specified fingerprint type.
- Args:
molecular_graph: The RDKit Mol object representing the molecule. fingerprint_type: The type of fingerprint representation to use.
- Returns:
The fingerprint of the molecular graph.
Descriptor Fitness¶
- class illumination.functions.fitness.USR_Fitness(config)[source]¶
Bases:
object
A strategy class for calculating the fitness of a molecule,based on its USR descriptors.
- Methods:
__init__: Initializes the USR_Fitness object with the target molecule and configuration parameters. __call__: Updates the fitness value of a molecule.
- Attributes:
n_conformers: The number of conformers to generate for each molecule. param: The parameters for embedding molecules. target: The target molecule. target_configuration: The embedded configuration of the target molecule. target_usrcat: The USR descriptor of the target molecule.
- class illumination.functions.fitness.USRCAT_Fitness(config)[source]¶
Bases:
object
A strategy class for calculating the fitness of a molecule.
- Methods:
__init__: Initializes the USRCAT_Fitness object with the target molecule and configuration parameters. __call__: Updates the fitness value of a molecule.
- Attributes:
n_conformers: The number of conformers to generate for each molecule. param: The parameters for embedding molecules. target: The target molecule. target_configuration: The embedded configuration of the target molecule. target_usrcat: The USRCAT descriptor of the target molecule.
- class illumination.functions.fitness.Zernike_Fitness(config)[source]¶
Bases:
object
A strategy class for calculating the fitness of a molecule using Zernike moments.
- Methods:
__init__: Initializes the Zernike_Fitness object with the target molecule and configuration parameters. __call__: Updates the fitness value of a molecule.
- Attributes:
N: The expansion order of the Zernike moments. prefactor: The prefactor for calculating Zernike moments. param: The parameters for embedding molecules. n_conformers: The number of conformers to generate for each molecule. Yljm: Coefficients used for computing Zernike moments. Qklnu: Coefficients used for computing Zernike moments. engine: An instance of the Zernike_JIT class for computing Zernike moments. target: The target molecule. target_zernike: The Zernike moments of the target molecule.
- coordinate_extractor(molecule, confid=-1)[source]¶
Extracts atomic coordinates from a molecule.
- Args:
molecule: The molecule from which to extract coordinates. confid (int, optional): The conformer ID. Defaults to -1.
- Returns:
numpy.ndarray: The atomic coordinates.
- get_zernike(molecular_graph, conf_id)[source]¶
Calculates Zernike moments for a molecule.
- Args:
molecular_graph: The molecule. conf_id: The conformer ID.
- Returns:
numpy.ndarray: The Zernike moments.
Gaucamol Fitness¶
- class illumination.functions.fitness.Gaucamol_Fitness(config)[source]¶
Bases:
object
A strategy class for calculating the fitness of a molecule, based on the Gaucamol benchmarks.
- Attributes:
target: The target molecule. oracle: The oracle used for fitness evaluation.
- Methods:
__init__: Initializes the Gaucamol_Fitness object with the target molecule and the oracle. __call__: Updates the fitness value of a molecule.
OVC Model Fitness¶
- class illumination.functions.fitness.OVC_Fitness(config)[source]¶
Bases:
object
A strategy class for calculating the fitness of a molecule using various models for organic photovoltaics based on autoML models provided by Tartarus.
- Attributes:
target: The type of fitness model to be used. model_homo_lumo: The model for predicting HOMO-LUMO energy gap. model_lumo_val: The model for predicting LUMO energy value. model_dipole: The model for predicting dipole moment. model_combined: The combined model for multiple properties.
- Methods:
__init__: Initializes the OVC_Fitness object with the specified target model. __call__: Updates the fitness value of a molecule using the specified model.