gt4sd.algorithms.conditional_generation.reinvent.implementation module

Implementation of Reinvent conditional generators.

Summary

Classes:

ReinventConditionalGenerator

SampledTuple

Reference

class SampledTuple(scaffold, decoration, nll)[source]

Bases: NamedTuple

scaffold: str

Alias for field number 0

decoration: str

Alias for field number 1

nll: float

Alias for field number 2

__annotations__ = {'decoration': <class 'str'>, 'nll': <class 'float'>, 'scaffold': <class 'str'>}
__doc__ = 'SampledTuple(scaffold, decoration, nll)'
__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

__match_args__ = ('scaffold', 'decoration', 'nll')
__module__ = 'gt4sd.algorithms.conditional_generation.reinvent.implementation'
__orig_bases__ = (<function NamedTuple>,)
__repr__()

Return a nicely formatted representation string

__slots__ = ()
_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('scaffold', 'decoration', 'nll')
classmethod _make(iterable)

Make a new SampledTuple object from a sequence or iterable

_replace(**kwds)

Return a new SampledTuple object replacing specified fields with new values

class ReinventConditionalGenerator(resources_path, batch_size, randomize, sample_uniquely, max_sequence_length)[source]

Bases: ReinventBase

__init__(resources_path, batch_size, randomize, sample_uniquely, max_sequence_length)[source]

Initialize Reinvent.

Parameters
  • resources_path (str) – path where to load hypothesis, candidate labels and, optionally, the model.

  • batch_size (int) – number of samples to generate per scaffold.

  • randomize (bool) – randomize the scaffolds if set to true.

  • sample_uniquely (bool) – generate unique sample sequences if set to true.

  • max_sequence_length (int) – maximum length of the generated sequences.

sample_unique_sequences(sampled_sequences)[source]

Samples the model for the given number of SMILES.

Parameters

scaffold_list – A list of SampledTuple.

Return type

List[Tuple]

Returns

A list of SampledTuple.

generate_sampled_tuples(scaffold)[source]

Samples the model for the given number of SMILES. :param scaffold_list: A list of scaffold SMILES.

Return type

Set[SampledTuple]

Returns

A Set of SampledTuple.

generate_samples(scaffold)[source]

Samples the model for the given number of SMILES.

Parameters

scaffold (str) – A scaffold SMILES.

Return type

Set[str]

Returns

A Set of SMILES representing molecules.

__doc__ = None
__module__ = 'gt4sd.algorithms.conditional_generation.reinvent.implementation'