poli.core.chemistry.tdc_black_box.TDCBlackBox#
- class poli.core.chemistry.tdc_black_box.TDCBlackBox(oracle_name: str, string_representation: Literal['SMILES', 'SELFIES'] = 'SMILES', alphabet: list[str] | None = None, max_sequence_length: int = inf, force_isolation: bool = False, batch_size: int = None, parallelize: bool = False, num_workers: int = None, evaluation_budget: int = inf, **kwargs_for_oracle)#
An abstract black box for the TDC (Therapeutics Data Commons) problems [1].
- Parameters
oracle_name (str) – The name of the oracle to be used.
string_representation (Literal["SMILES", "SELFIES"], optional) – A string (either “SMILES” or “SELFIES”) specifying which molecule representation you plan to use.
alphabet (list[str] | None, optional) – The alphabet to be used for the SMILES or SELFIES representation. It is common that the alphabet depends on the dataset used, so it is recommended to pass it as an argument. Default is None.
max_sequence_length (int, optional) – The maximum length of the sequence. Default is infinity.
batch_size (int, optional) – The batch size for simultaneous execution, by default None.
parallelize (bool, optional) – Flag indicating whether to parallelize execution, by default False.
num_workers (int, optional) – The number of workers for parallel execution, by default None.
evaluation_budget (int, optional) – The maximum number of function evaluations. Default is infinity.
force_isolation (bool, optional) – Whether to force the isolation of the black box. Default is False.
**kwargs_for_oracle (dict) – Other keyword arguments to be passed to the oracle.
- oracle_name#
The name of the oracle.
- Type
str
- __init__(self, oracle_name, string_representation="SMILES", force_isolation=False, batch_size=None, parallelize=False, num_workers=None, evaluation_budget=float("inf"), \*\*kwargs_for_oracle
Initializes a new instance of the abstract TDC class.
References
- [1] Artificial intelligence foundation for therapeutic science.
Huang, K., Fu, T., Gao, W. et al. Nat Chem Biol 18, 1033-1036 (2022). https://doi.org/10.1038/s41589-022-01131-2
- __init__(oracle_name: str, string_representation: Literal['SMILES', 'SELFIES'] = 'SMILES', alphabet: list[str] | None = None, max_sequence_length: int = inf, force_isolation: bool = False, batch_size: int = None, parallelize: bool = False, num_workers: int = None, evaluation_budget: int = inf, **kwargs_for_oracle)#
Initialize the AbstractBlackBox object.
- Parameters
batch_size (int, optional) – The batch size for parallel execution, by default None.
parallelize (bool, optional) – Flag indicating whether to parallelize the execution, by default False.
num_workers (int, optional) – The number of workers for parallel execution, by default we use half the available CPUs.
evaluation_budget (int, optional) – The maximum number of evaluations allowed for the black box function, by default float(“inf”).
Methods
__init__
(oracle_name[, ...])Initialize the AbstractBlackBox object.
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.