poli.objective_repository.rdkit_logp.register.LogPBlackBox#
- class poli.objective_repository.rdkit_logp.register.LogPBlackBox(string_representation: Literal['SMILES', 'SELFIES'] = 'SMILES', batch_size: Optional[int] = None, parallelize: bool = False, num_workers: Optional[int] = None, evaluation_budget: int = inf)#
Log-solubility of a small molecule.
A simple black box that returns the LogP of a molecule. By default, we assume that the result of concatenating the tokens will be a SMILES string, but you can set the context variable “from_selfies” to True to indicate that the input is a SELFIES string.
RDKit’s Chem.MolFromSmiles function and logP are known for failing silently, so we return NaN if the molecule cannot be parsed or if qed returns something other than a float.
- Parameters
string_representation (Literal["SMILES", "SELFIES"], optional) – The string representation to use, by default “SMILES”.
batch_size (int, optional) – The batch size for processing multiple inputs simultaneously, by default None.
parallelize (bool, optional) – Flag indicating whether to parallelize the computation, by default False.
num_workers (int, optional) – The number of workers to use for parallel computation, by default None.
evaluation_budget (int, optional) – The maximum number of function evaluations. Default is infinity.
- from_selfies#
Flag indicating whether the input is a SELFIES string.
- Type
bool
- from_smiles#
Flag indicating whether the input is a SMILES string.
- Type
bool
- _black_box(x, context=None)#
The main black box method that performs the computation, i.e. it computes the logP of the molecule in x.
- __init__(string_representation: Literal['SMILES', 'SELFIES'] = 'SMILES', batch_size: Optional[int] = None, parallelize: bool = False, num_workers: Optional[int] = None, evaluation_budget: int = inf)#
Initializes the LogP black box.
- Parameters
string_representation (Literal["SMILES", "SELFIES"], optional) – The string representation to use, by default “SMILES”.
batch_size (int, optional) – The batch size for processing multiple inputs simultaneously, by default None.
parallelize (bool, optional) – Flag indicating whether to parallelize the computation, by default False.
num_workers (int, optional) – The number of workers to use for parallel computation, by default None.
evaluation_budget (int, optional) – The maximum number of function evaluations. Default is infinity.
Methods
__init__
([string_representation, ...])Initializes the LogP black box.
reset_evaluation_budget
()Resets the evaluation budget by setting the number of evaluations made to 0.
set_observer
(observer)Set the observer object for recording observations during evaluation.
terminate
()Terminate the black box optimization problem.