gt4sd.algorithms.conditional_generation.guacamol.core module¶
Summary¶
Classes:
Configuration to generate molecules using an adversarial autoencoder. |
|
Configuration to generate optimizied molecules using Graph-Based Genetic algorithm |
|
Configuration to generate optimizied molecules using Graph-based Genetic Algorithm and Generative Model/Monte Carlo Tree Search for the Exploration of Chemical Space |
|
GuacaMol generation algorithm. |
|
Moses generation algorithm. |
|
Configuration to generate molecules using Objective-Reinforced Generative Adversarial Network |
|
Configuration to generate optimizied molecules using SMILES Genetic algorithm |
|
Configuration to generate optimized molecules using recurrent neural networks with hill climbing algorithm. |
|
Configuration to generate optimizied molecules using recurrent neural networks with hill climbing algorithm |
|
Configuration to generate molecules using a variational autoencoder. |
Reference¶
- class GuacaMolGenerator(configuration, target)[source]¶
Bases:
GeneratorAlgorithm
[S
,T
]GuacaMol generation algorithm.
- __init__(configuration, target)[source]¶
Instantiate GuacaMolGenerator ready to generate samples.
- Parameters
configuration (
AlgorithmConfiguration
[~S, ~T]) – domain and application specification defining parameters, types and validations.target (
Optional
[~T,None
]) – a target for which to generate items.
Example
An example for generating molecules given a scoring function and a score:
config = SMILESGAGenerator() target = {"scoring_function_name": {"target": 0.0}} algorithm = GuacaMolGenerator(configuration=config, target=target) items = list(algorithm.sample(1)) print(items)
- get_generator(configuration, target)[source]¶
Get the function to perform the prediction via GuacaMol’s generator.
- Parameters
configuration (
AlgorithmConfiguration
[~S, ~T]) – helps to set up specific application of GuacaMol.- Return type
Callable
[[~T],Iterable
[Any
]]- Returns
callable with target generating samples.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'generate': 'Untargeted', 'generator': 'Union[Untargeted, Targeted[T]]', 'max_runtime': 'int', 'max_samples': 'int', 'target': 'Optional[T]'}¶
- __doc__ = 'GuacaMol generation algorithm.'¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (gt4sd.algorithms.core.GeneratorAlgorithm[~S, ~T],)¶
- __parameters__ = (~S, ~T)¶
- _abc_impl = <_abc._abc_data object>¶
- class GuacaMolAbstractGenerator(algorithm_version='')[source]¶
Bases:
AlgorithmConfiguration
[str
,str
]- validate_item(item)[source]¶
Check that item is a valid SMILES.
- Parameters
item (
str
) – a generated item that is possibly not valid.- Raises
InvalidItem – in case the item can not be validated.
- Return type
str
- Returns
the validated SMILES.
- __annotations__ = {}¶
- __doc__ = None¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (gt4sd.algorithms.core.AlgorithmConfiguration[str, str],)¶
- __parameters__ = ()¶
- class SMILESGAGenerator(*args, **kwargs)[source]¶
Bases:
SMILESGAGenerator
,Generic
[T
]Configuration to generate optimizied molecules using SMILES Genetic algorithm
- algorithm_name: ClassVar[str] = 'GuacaMolGenerator'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- algorithm_type: ClassVar[str] = 'conditional_generation'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'materials'¶
General application domain. Hints at input/output types.
- algorithm_version: str = 'v0'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- batch_size: int = 32¶
- population_size: int = 100¶
- n_mutations: int = 200¶
- n_jobs: int = -1¶
- gene_size: int = 2¶
- random_start: bool = False¶
- generations: int = 2¶
- patience: int = 4¶
- get_target_description()[source]¶
Get description of the target for generation.
- Return type
Dict
[str
,str
]- Returns
target description.
- get_conditional_generator(resources_path)[source]¶
Instantiate the actual generator implementation.
- Parameters
resources_path (
str
) – local path to model files.- Return type
- Returns
instance with
generate_batch
method for targeted generation.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'domain': typing.ClassVar[str], 'gene_size': <class 'int'>, 'generations': <class 'int'>, 'n_jobs': <class 'int'>, 'n_mutations': <class 'int'>, 'patience': <class 'int'>, 'population_size': <class 'int'>, 'random_start': <class 'bool'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='SMILESGAGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=32,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'gene_size': Field(name='gene_size',type=<class 'int'>,default=2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'size of the gene which is used in creation of genes'}),kw_only=False,_field_type=_FIELD), 'generations': Field(name='generations',type=<class 'int'>,default=2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of evolutionary generations'}),kw_only=False,_field_type=_FIELD), 'n_jobs': Field(name='n_jobs',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of concurrently running jobs'}),kw_only=False,_field_type=_FIELD), 'n_mutations': Field(name='n_mutations',type=<class 'int'>,default=200,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used with population size for the initial generation of smiles within the population'}),kw_only=False,_field_type=_FIELD), 'patience': Field(name='patience',type=<class 'int'>,default=4,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used for early stopping if population scores remains the same after generating molecules'}),kw_only=False,_field_type=_FIELD), 'population_size': Field(name='population_size',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used with n_mutations for the initial generation of smiles within the population'}),kw_only=False,_field_type=_FIELD), 'random_start': Field(name='random_start',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimizied molecules using SMILES Genetic algorithm'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'population_size', 'n_mutations', 'n_jobs', 'gene_size', 'random_start', 'generations', 'patience')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.SMILESGAGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.SMILESGAGenerator'>, 'config': {'title': 'SMILESGAGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'population_size', 'n_mutations', 'n_jobs', 'gene_size', 'random_start', 'generations', 'patience'], 'frozen': False, 'post_init': False, 'ref': 'types.SMILESGAGenerator:93913118282304', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'SMILESGAGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 32}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'population_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used with n_mutations for the initial generation of smiles within the population'}}}, {'type': 'dataclass-field', 'name': 'n_mutations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 200}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used with population size for the initial generation of smiles within the population'}}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of concurrently running jobs'}}}, {'type': 'dataclass-field', 'name': 'gene_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'size of the gene which is used in creation of genes'}}}, {'type': 'dataclass-field', 'name': 'random_start', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}}}, {'type': 'dataclass-field', 'name': 'generations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of evolutionary generations'}}}, {'type': 'dataclass-field', 'name': 'patience', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used for early stopping if population scores remains the same after generating molecules'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=32, description='Batch size used for the generative model sampling.', init=True, init_var=False, kw_only=False), 'gene_size': FieldInfo(annotation=int, required=False, default=2, description='size of the gene which is used in creation of genes', init=True, init_var=False, kw_only=False), 'generations': FieldInfo(annotation=int, required=False, default=2, description='number of evolutionary generations', init=True, init_var=False, kw_only=False), 'n_jobs': FieldInfo(annotation=int, required=False, default=-1, description='number of concurrently running jobs', init=True, init_var=False, kw_only=False), 'n_mutations': FieldInfo(annotation=int, required=False, default=200, description='it is used with population size for the initial generation of smiles within the population', init=True, init_var=False, kw_only=False), 'patience': FieldInfo(annotation=int, required=False, default=4, description='it is used for early stopping if population scores remains the same after generating molecules', init=True, init_var=False, kw_only=False), 'population_size': FieldInfo(annotation=int, required=False, default=100, description='it is used with n_mutations for the initial generation of smiles within the population', init=True, init_var=False, kw_only=False), 'random_start': FieldInfo(annotation=bool, required=False, default=False, description='set to True to randomly choose list of SMILES for generating optimizied molecules', init=True, init_var=False, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields where successfully collected (i.e. type hints were successfully resolves).
This is a private property, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005569da0e1240, ), serializer: Fields( GeneralFieldsSerializer { fields: { "n_mutations": SerField { key_py: Py( 0x00007f856106d930, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a19d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "patience": SerField { key_py: Py( 0x00007f856106da70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0150, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "batch_size": SerField { key_py: Py( 0x00007f856106d8b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a04d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "algorithm_version": SerField { key_py: Py( 0x00007f8561066100, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c298a30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "population_size": SerField { key_py: Py( 0x00007f856106d8f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "n_jobs": SerField { key_py: Py( 0x00007f856106d970, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a00b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "gene_size": SerField { key_py: Py( 0x00007f856106d9b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "random_start": SerField { key_py: Py( 0x00007f856106d9f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00005569c2101580, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "generations": SerField { key_py: Py( 0x00007f856106da30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 9, }, ), fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c2990b0, ), Py( 0x00007f863c2994b0, ), Py( 0x00007f863c2983b0, ), Py( 0x00007f863c2990f0, ), Py( 0x00007f863c2987b0, ), Py( 0x00007f863c2984b0, ), Py( 0x00007f863c299130, ), ], name: "SMILESGAGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="SMILESGAGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f863c2ac030, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "algorithm_version", py_key: Py( 0x00007f85610660b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c298a30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f863c299270, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "batch_size", py_key: Py( 0x00007f856106c9b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a04d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "population_size", py_name: Py( 0x00007f863c2990b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "population_size", py_key: Py( 0x00007f856106ca70, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_mutations", py_name: Py( 0x00007f863c2994b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_mutations", py_key: Py( 0x00007f856106cc30, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a19d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", py_name: Py( 0x00007f863c2983b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_jobs", py_key: Py( 0x00007f856106d4f0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a00b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "gene_size", py_name: Py( 0x00007f863c2990f0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "gene_size", py_key: Py( 0x00007f856106d7b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "random_start", py_name: Py( 0x00007f863c2987b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "random_start", py_key: Py( 0x00007f856106d7f0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00005569c2101580, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "generations", py_name: Py( 0x00007f863c2984b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "generations", py_key: Py( 0x00007f856106d830, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "patience", py_name: Py( 0x00007f863c299130, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "patience", py_key: Py( 0x00007f856106d870, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0150, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, ], positional_count: 9, init_only_count: None, dataclass_name: "SMILESGAGenerator", validator_name: "dataclass-args[SMILESGAGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005569da0e1240, ), generic_origin: None, fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c2990b0, ), Py( 0x00007f863c2994b0, ), Py( 0x00007f863c2983b0, ), Py( 0x00007f863c2990f0, ), Py( 0x00007f863c2987b0, ), Py( 0x00007f863c2984b0, ), Py( 0x00007f863c299130, ), ], post_init: None, revalidate: Never, name: "SMILESGAGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: str = 'v0', batch_size: int = 32, population_size: int = 100, n_mutations: int = 200, n_jobs: int = -1, gene_size: int = 2, random_start: bool = False, generations: int = 2, patience: int = 4) -> None>¶
- __wrapped__¶
alias of
SMILESGAGenerator
- class GraphGAGenerator(*args, **kwargs)[source]¶
Bases:
GraphGAGenerator
,Generic
[T
]Configuration to generate optimizied molecules using Graph-Based Genetic algorithm
- algorithm_name: ClassVar[str] = 'GuacaMolGenerator'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- algorithm_type: ClassVar[str] = 'conditional_generation'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'materials'¶
General application domain. Hints at input/output types.
- algorithm_version: str = 'v0'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- batch_size: int = 1¶
- population_size: int = 100¶
- mutation_rate: float = 0.01¶
- offspring_size: int = 200¶
- n_jobs: int = -1¶
- random_start: bool = False¶
- generations: int = 2¶
- patience: int = 4¶
- get_target_description()[source]¶
Get description of the target for generation.
- Return type
Dict
[str
,str
]- Returns
target description.
- get_conditional_generator(resources_path)[source]¶
Instantiate the actual generator implementation.
- Parameters
resources_path (
str
) – local path to model files.- Return type
- Returns
instance with
generate_batch
method for targeted generation.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'domain': typing.ClassVar[str], 'generations': <class 'int'>, 'mutation_rate': <class 'float'>, 'n_jobs': <class 'int'>, 'offspring_size': <class 'int'>, 'patience': <class 'int'>, 'population_size': <class 'int'>, 'random_start': <class 'bool'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='GraphGAGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'generations': Field(name='generations',type=<class 'int'>,default=2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of evolutionary generations'}),kw_only=False,_field_type=_FIELD), 'mutation_rate': Field(name='mutation_rate',type=<class 'float'>,default=0.01,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'frequency of the new mutations in a single gene or organism over time'}),kw_only=False,_field_type=_FIELD), 'n_jobs': Field(name='n_jobs',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of concurrently running jobs'}),kw_only=False,_field_type=_FIELD), 'offspring_size': Field(name='offspring_size',type=<class 'int'>,default=200,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of molecules to select for new population'}),kw_only=False,_field_type=_FIELD), 'patience': Field(name='patience',type=<class 'int'>,default=4,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used for early stopping if population scores remains the same after generating molecules'}),kw_only=False,_field_type=_FIELD), 'population_size': Field(name='population_size',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used with n_mutations for the initial generation of smiles within the population'}),kw_only=False,_field_type=_FIELD), 'random_start': Field(name='random_start',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimizied molecules using Graph-Based Genetic algorithm'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'population_size', 'mutation_rate', 'offspring_size', 'n_jobs', 'random_start', 'generations', 'patience')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.GraphGAGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.GraphGAGenerator'>, 'config': {'title': 'GraphGAGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'population_size', 'mutation_rate', 'offspring_size', 'n_jobs', 'random_start', 'generations', 'patience'], 'frozen': False, 'post_init': False, 'ref': 'types.GraphGAGenerator:93913118157680', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'GraphGAGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'population_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used with n_mutations for the initial generation of smiles within the population'}}}, {'type': 'dataclass-field', 'name': 'mutation_rate', 'schema': {'type': 'default', 'schema': {'type': 'float'}, 'default': 0.01}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'frequency of the new mutations in a single gene or organism over time'}}}, {'type': 'dataclass-field', 'name': 'offspring_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 200}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of molecules to select for new population'}}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of concurrently running jobs'}}}, {'type': 'dataclass-field', 'name': 'random_start', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}}}, {'type': 'dataclass-field', 'name': 'generations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of evolutionary generations'}}}, {'type': 'dataclass-field', 'name': 'patience', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used for early stopping if population scores remains the same after generating molecules'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=1, description='Batch size used for the generative model sampling.', init=True, init_var=False, kw_only=False), 'generations': FieldInfo(annotation=int, required=False, default=2, description='number of evolutionary generations', init=True, init_var=False, kw_only=False), 'mutation_rate': FieldInfo(annotation=float, required=False, default=0.01, description='frequency of the new mutations in a single gene or organism over time', init=True, init_var=False, kw_only=False), 'n_jobs': FieldInfo(annotation=int, required=False, default=-1, description='number of concurrently running jobs', init=True, init_var=False, kw_only=False), 'offspring_size': FieldInfo(annotation=int, required=False, default=200, description='number of molecules to select for new population', init=True, init_var=False, kw_only=False), 'patience': FieldInfo(annotation=int, required=False, default=4, description='it is used for early stopping if population scores remains the same after generating molecules', init=True, init_var=False, kw_only=False), 'population_size': FieldInfo(annotation=int, required=False, default=100, description='it is used with n_mutations for the initial generation of smiles within the population', init=True, init_var=False, kw_only=False), 'random_start': FieldInfo(annotation=bool, required=False, default=False, description='set to True to randomly choose list of SMILES for generating optimizied molecules', init=True, init_var=False, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields where successfully collected (i.e. type hints were successfully resolves).
This is a private property, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005569da0c2b70, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key_py: Py( 0x00007f85610823d0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c298a30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "patience": SerField { key_py: Py( 0x00007f856107ebb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0150, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "random_start": SerField { key_py: Py( 0x00007f856107eb30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00005569c2101580, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "n_jobs": SerField { key_py: Py( 0x00007f856107eaf0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a00b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "mutation_rate": SerField { key_py: Py( 0x00007f856107ea70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c270130, ), ), serializer: Float( FloatSerializer { inf_nan_mode: Null, }, ), }, ), ), required: true, serialize_by_alias: None, }, "generations": SerField { key_py: Py( 0x00007f856107eb70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "batch_size": SerField { key_py: Py( 0x00007f856107e9f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a00f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "offspring_size": SerField { key_py: Py( 0x00007f856107eab0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a19d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "population_size": SerField { key_py: Py( 0x00007f856107ea30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 9, }, ), fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c2990b0, ), Py( 0x00007f863c298670, ), Py( 0x00007f863c29a570, ), Py( 0x00007f863c2983b0, ), Py( 0x00007f863c2987b0, ), Py( 0x00007f863c2984b0, ), Py( 0x00007f863c299130, ), ], name: "GraphGAGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="GraphGAGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f863c2ac030, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "algorithm_version", py_key: Py( 0x00007f8561082380, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c298a30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f863c299270, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "batch_size", py_key: Py( 0x00007f856107dbf0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a00f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "population_size", py_name: Py( 0x00007f863c2990b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "population_size", py_key: Py( 0x00007f856107d830, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "mutation_rate", py_name: Py( 0x00007f863c298670, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "mutation_rate", py_key: Py( 0x00007f856107deb0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c270130, ), ), on_error: Raise, validator: Float( FloatValidator { strict: false, allow_inf_nan: true, }, ), validate_default: false, copy_default: false, name: "default[float]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "offspring_size", py_name: Py( 0x00007f863c29a570, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "offspring_size", py_key: Py( 0x00007f856107e8b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a19d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", py_name: Py( 0x00007f863c2983b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_jobs", py_key: Py( 0x00007f856107e8f0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a00b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "random_start", py_name: Py( 0x00007f863c2987b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "random_start", py_key: Py( 0x00007f856107e930, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00005569c2101580, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "generations", py_name: Py( 0x00007f863c2984b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "generations", py_key: Py( 0x00007f856107e970, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "patience", py_name: Py( 0x00007f863c299130, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "patience", py_key: Py( 0x00007f856107e9b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0150, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, ], positional_count: 9, init_only_count: None, dataclass_name: "GraphGAGenerator", validator_name: "dataclass-args[GraphGAGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005569da0c2b70, ), generic_origin: None, fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c2990b0, ), Py( 0x00007f863c298670, ), Py( 0x00007f863c29a570, ), Py( 0x00007f863c2983b0, ), Py( 0x00007f863c2987b0, ), Py( 0x00007f863c2984b0, ), Py( 0x00007f863c299130, ), ], post_init: None, revalidate: Never, name: "GraphGAGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: str = 'v0', batch_size: int = 1, population_size: int = 100, mutation_rate: float = 0.01, offspring_size: int = 200, n_jobs: int = -1, random_start: bool = False, generations: int = 2, patience: int = 4) -> None>¶
- __wrapped__¶
alias of
GraphGAGenerator
- class GraphMCTSGenerator(*args, **kwargs)[source]¶
Bases:
GraphMCTSGenerator
,Generic
[T
]Configuration to generate optimizied molecules using Graph-based Genetic Algorithm and Generative Model/Monte Carlo Tree Search for the Exploration of Chemical Space
- algorithm_name: ClassVar[str] = 'GuacaMolGenerator'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- algorithm_type: ClassVar[str] = 'conditional_generation'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'materials'¶
General application domain. Hints at input/output types.
- algorithm_version: str = 'v0'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- batch_size: int = 1¶
- init_smiles: str = ''¶
- population_size: int = 100¶
- n_jobs: int = -1¶
- generations: int = 1000¶
- patience: int = 4¶
- num_sims: float = 40¶
- max_children: int = 25¶
- max_atoms: int = 60¶
- get_target_description()[source]¶
Get description of the target for generation.
- Return type
Dict
[str
,str
]- Returns
target description.
- get_conditional_generator(resources_path)[source]¶
Instantiate the actual generator implementation.
- Parameters
resources_path (
str
) – local path to model files.- Return type
- Returns
instance with
generate_batch
method for targeted generation.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'domain': typing.ClassVar[str], 'generations': <class 'int'>, 'init_smiles': <class 'str'>, 'max_atoms': <class 'int'>, 'max_children': <class 'int'>, 'n_jobs': <class 'int'>, 'num_sims': <class 'float'>, 'patience': <class 'int'>, 'population_size': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='GraphMCTSGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'generations': Field(name='generations',type=<class 'int'>,default=1000,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of evolutionary generations'}),kw_only=False,_field_type=_FIELD), 'init_smiles': Field(name='init_smiles',type=<class 'str'>,default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'initial SMILES used for generation of states.'}),kw_only=False,_field_type=_FIELD), 'max_atoms': Field(name='max_atoms',type=<class 'int'>,default=60,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'maximum number of atoms to explore to terminal the node state'}),kw_only=False,_field_type=_FIELD), 'max_children': Field(name='max_children',type=<class 'int'>,default=25,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'maximum number of childerns a node could have'}),kw_only=False,_field_type=_FIELD), 'n_jobs': Field(name='n_jobs',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of concurrently running jobs'}),kw_only=False,_field_type=_FIELD), 'num_sims': Field(name='num_sims',type=<class 'float'>,default=40,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of times to traverse the tree'}),kw_only=False,_field_type=_FIELD), 'patience': Field(name='patience',type=<class 'int'>,default=4,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used for early stopping if population scores remains the same after generating molecules'}),kw_only=False,_field_type=_FIELD), 'population_size': Field(name='population_size',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used with n_mutations for the initial generation of smiles within the population'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimizied molecules using Graph-based Genetic Algorithm and Generative Model/Monte Carlo Tree Search for the Exploration of Chemical Space'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'init_smiles', 'population_size', 'n_jobs', 'generations', 'patience', 'num_sims', 'max_children', 'max_atoms')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.GraphMCTSGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.GraphMCTSGenerator'>, 'config': {'title': 'GraphMCTSGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'init_smiles', 'population_size', 'n_jobs', 'generations', 'patience', 'num_sims', 'max_children', 'max_atoms'], 'frozen': False, 'post_init': False, 'ref': 'types.GraphMCTSGenerator:93913117451520', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'GraphMCTSGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'init_smiles', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': ''}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'initial SMILES used for generation of states.'}}}, {'type': 'dataclass-field', 'name': 'population_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used with n_mutations for the initial generation of smiles within the population'}}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of concurrently running jobs'}}}, {'type': 'dataclass-field', 'name': 'generations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1000}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of evolutionary generations'}}}, {'type': 'dataclass-field', 'name': 'patience', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used for early stopping if population scores remains the same after generating molecules'}}}, {'type': 'dataclass-field', 'name': 'num_sims', 'schema': {'type': 'default', 'schema': {'type': 'float'}, 'default': 40}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of times to traverse the tree'}}}, {'type': 'dataclass-field', 'name': 'max_children', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 25}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'maximum number of childerns a node could have'}}}, {'type': 'dataclass-field', 'name': 'max_atoms', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 60}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'maximum number of atoms to explore to terminal the node state'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=1, description='Batch size used for the generative model sampling.', init=True, init_var=False, kw_only=False), 'generations': FieldInfo(annotation=int, required=False, default=1000, description='number of evolutionary generations', init=True, init_var=False, kw_only=False), 'init_smiles': FieldInfo(annotation=str, required=False, default='', description='initial SMILES used for generation of states.', init=True, init_var=False, kw_only=False), 'max_atoms': FieldInfo(annotation=int, required=False, default=60, description='maximum number of atoms to explore to terminal the node state', init=True, init_var=False, kw_only=False), 'max_children': FieldInfo(annotation=int, required=False, default=25, description='maximum number of childerns a node could have', init=True, init_var=False, kw_only=False), 'n_jobs': FieldInfo(annotation=int, required=False, default=-1, description='number of concurrently running jobs', init=True, init_var=False, kw_only=False), 'num_sims': FieldInfo(annotation=float, required=False, default=40, description='number of times to traverse the tree', init=True, init_var=False, kw_only=False), 'patience': FieldInfo(annotation=int, required=False, default=4, description='it is used for early stopping if population scores remains the same after generating molecules', init=True, init_var=False, kw_only=False), 'population_size': FieldInfo(annotation=int, required=False, default=100, description='it is used with n_mutations for the initial generation of smiles within the population', init=True, init_var=False, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields where successfully collected (i.e. type hints were successfully resolves).
This is a private property, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005569da016500, ), serializer: Fields( GeneralFieldsSerializer { fields: { "max_atoms": SerField { key_py: Py( 0x00007f85610929b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0850, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "batch_size": SerField { key_py: Py( 0x00007f85610927b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a00f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "algorithm_version": SerField { key_py: Py( 0x00007f8560ea06c0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c298a30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "population_size": SerField { key_py: Py( 0x00007f8561092830, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "n_jobs": SerField { key_py: Py( 0x00007f8561092870, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a00b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "patience": SerField { key_py: Py( 0x00007f85610928f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0150, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "generations": SerField { key_py: Py( 0x00007f85610928b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c270090, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "init_smiles": SerField { key_py: Py( 0x00007f85610927f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a8030, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "num_sims": SerField { key_py: Py( 0x00007f8561092930, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a05d0, ), ), serializer: Float( FloatSerializer { inf_nan_mode: Null, }, ), }, ), ), required: true, serialize_by_alias: None, }, "max_children": SerField { key_py: Py( 0x00007f8561092970, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a03f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 10, }, ), fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c2985f0, ), Py( 0x00007f863c2990b0, ), Py( 0x00007f863c2983b0, ), Py( 0x00007f863c2984b0, ), Py( 0x00007f863c299130, ), Py( 0x00007f863c29a670, ), Py( 0x00007f863c29a7b0, ), Py( 0x00007f863c29a870, ), ], name: "GraphMCTSGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="GraphMCTSGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f863c2ac030, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "algorithm_version", py_key: Py( 0x00007f8560ea0670, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c298a30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f863c299270, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "batch_size", py_key: Py( 0x00007f8561091a70, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a00f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "init_smiles", py_name: Py( 0x00007f863c2985f0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "init_smiles", py_key: Py( 0x00007f85610923b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a8030, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "population_size", py_name: Py( 0x00007f863c2990b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "population_size", py_key: Py( 0x00007f85610925f0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", py_name: Py( 0x00007f863c2983b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_jobs", py_key: Py( 0x00007f8561092630, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a00b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "generations", py_name: Py( 0x00007f863c2984b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "generations", py_key: Py( 0x00007f8561092670, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c270090, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "patience", py_name: Py( 0x00007f863c299130, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "patience", py_key: Py( 0x00007f85610926b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0150, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "num_sims", py_name: Py( 0x00007f863c29a670, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "num_sims", py_key: Py( 0x00007f85610926f0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a05d0, ), ), on_error: Raise, validator: Float( FloatValidator { strict: false, allow_inf_nan: true, }, ), validate_default: false, copy_default: false, name: "default[float]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_children", py_name: Py( 0x00007f863c29a7b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "max_children", py_key: Py( 0x00007f8561092730, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a03f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_atoms", py_name: Py( 0x00007f863c29a870, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "max_atoms", py_key: Py( 0x00007f8561092770, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0850, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, ], positional_count: 10, init_only_count: None, dataclass_name: "GraphMCTSGenerator", validator_name: "dataclass-args[GraphMCTSGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005569da016500, ), generic_origin: None, fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c2985f0, ), Py( 0x00007f863c2990b0, ), Py( 0x00007f863c2983b0, ), Py( 0x00007f863c2984b0, ), Py( 0x00007f863c299130, ), Py( 0x00007f863c29a670, ), Py( 0x00007f863c29a7b0, ), Py( 0x00007f863c29a870, ), ], post_init: None, revalidate: Never, name: "GraphMCTSGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: str = 'v0', batch_size: int = 1, init_smiles: str = '', population_size: int = 100, n_jobs: int = -1, generations: int = 1000, patience: int = 4, num_sims: float = 40, max_children: int = 25, max_atoms: int = 60) -> None>¶
- __wrapped__¶
alias of
GraphMCTSGenerator
- class SMILESLSTMHCGenerator(*args, **kwargs)[source]¶
Bases:
SMILESLSTMHCGenerator
,Generic
[T
]Configuration to generate optimized molecules using recurrent neural networks with hill climbing algorithm.
- algorithm_name: ClassVar[str] = 'GuacaMolGenerator'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- algorithm_type: ClassVar[str] = 'conditional_generation'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'materials'¶
General application domain. Hints at input/output types.
- algorithm_version: str = 'v0'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- batch_size: int = 1¶
- n_jobs: int = -1¶
- n_epochs: int = 20¶
- mols_to_sample: int = 1024¶
- keep_top: int = 512¶
- optimize_n_epochs: int = 2¶
- max_len: int = 100¶
- optimize_batch_size: int = 256¶
- benchmark_num_samples: int = 4096¶
- random_start: bool = False¶
- get_target_description()[source]¶
Get description of the target for generation.
- Return type
Dict
[str
,str
]- Returns
target description.
- get_conditional_generator(resources_path)[source]¶
Instantiate the actual generator implementation.
- Parameters
resources_path (
str
) – local path to model files.- Return type
- Returns
instance with
generate_batch
method for targeted generation.
- classmethod get_filepath_mappings_for_training_pipeline_arguments()[source]¶
Ger filepath mappings for the given training pipeline arguments.
- Parameters
training_pipeline_arguments (
TrainingPipelineArguments
) – training pipeline arguments.- Return type
Dict
[str
,str
]- Returns
a mapping between artifacts’ files and training pipeline’s output files.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'benchmark_num_samples': <class 'int'>, 'domain': typing.ClassVar[str], 'keep_top': <class 'int'>, 'max_len': <class 'int'>, 'mols_to_sample': <class 'int'>, 'n_epochs': <class 'int'>, 'n_jobs': <class 'int'>, 'optimize_batch_size': <class 'int'>, 'optimize_n_epochs': <class 'int'>, 'random_start': <class 'bool'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='SMILESLSTMHCGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'benchmark_num_samples': Field(name='benchmark_num_samples',type=<class 'int'>,default=4096,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of molecules to generate from final model for the benchmark'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'keep_top': Field(name='keep_top',type=<class 'int'>,default=512,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'maximum length of a SMILES string'}),kw_only=False,_field_type=_FIELD), 'max_len': Field(name='max_len',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'maximum length of a SMILES string'}),kw_only=False,_field_type=_FIELD), 'mols_to_sample': Field(name='mols_to_sample',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'molecules sampled at each step'}),kw_only=False,_field_type=_FIELD), 'n_epochs': Field(name='n_epochs',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of epochs to sample'}),kw_only=False,_field_type=_FIELD), 'n_jobs': Field(name='n_jobs',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of concurrently running jobs'}),kw_only=False,_field_type=_FIELD), 'optimize_batch_size': Field(name='optimize_batch_size',type=<class 'int'>,default=256,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'batch size for the optimization'}),kw_only=False,_field_type=_FIELD), 'optimize_n_epochs': Field(name='optimize_n_epochs',type=<class 'int'>,default=2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of epochs for the optimization'}),kw_only=False,_field_type=_FIELD), 'random_start': Field(name='random_start',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimized molecules using recurrent neural networks with hill climbing algorithm.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'n_jobs', 'n_epochs', 'mols_to_sample', 'keep_top', 'optimize_n_epochs', 'max_len', 'optimize_batch_size', 'benchmark_num_samples', 'random_start')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.SMILESLSTMHCGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.SMILESLSTMHCGenerator'>, 'config': {'title': 'SMILESLSTMHCGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'n_jobs', 'n_epochs', 'mols_to_sample', 'keep_top', 'optimize_n_epochs', 'max_len', 'optimize_batch_size', 'benchmark_num_samples', 'random_start'], 'frozen': False, 'post_init': False, 'ref': 'types.SMILESLSTMHCGenerator:93913117448832', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'SMILESLSTMHCGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of concurrently running jobs'}}}, {'type': 'dataclass-field', 'name': 'n_epochs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of epochs to sample'}}}, {'type': 'dataclass-field', 'name': 'mols_to_sample', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'molecules sampled at each step'}}}, {'type': 'dataclass-field', 'name': 'keep_top', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 512}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'maximum length of a SMILES string'}}}, {'type': 'dataclass-field', 'name': 'optimize_n_epochs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of epochs for the optimization'}}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'maximum length of a SMILES string'}}}, {'type': 'dataclass-field', 'name': 'optimize_batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 256}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'benchmark_num_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4096}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of molecules to generate from final model for the benchmark'}}}, {'type': 'dataclass-field', 'name': 'random_start', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=1, description='Batch size used for the generative model sampling.', init=True, init_var=False, kw_only=False), 'benchmark_num_samples': FieldInfo(annotation=int, required=False, default=4096, description='number of molecules to generate from final model for the benchmark', init=True, init_var=False, kw_only=False), 'keep_top': FieldInfo(annotation=int, required=False, default=512, description='maximum length of a SMILES string', init=True, init_var=False, kw_only=False), 'max_len': FieldInfo(annotation=int, required=False, default=100, description='maximum length of a SMILES string', init=True, init_var=False, kw_only=False), 'mols_to_sample': FieldInfo(annotation=int, required=False, default=1024, description='molecules sampled at each step', init=True, init_var=False, kw_only=False), 'n_epochs': FieldInfo(annotation=int, required=False, default=20, description='number of epochs to sample', init=True, init_var=False, kw_only=False), 'n_jobs': FieldInfo(annotation=int, required=False, default=-1, description='number of concurrently running jobs', init=True, init_var=False, kw_only=False), 'optimize_batch_size': FieldInfo(annotation=int, required=False, default=256, description='batch size for the optimization', init=True, init_var=False, kw_only=False), 'optimize_n_epochs': FieldInfo(annotation=int, required=False, default=2, description='number of epochs for the optimization', init=True, init_var=False, kw_only=False), 'random_start': FieldInfo(annotation=bool, required=False, default=False, description='set to True to randomly choose list of SMILES for generating optimizied molecules', init=True, init_var=False, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields where successfully collected (i.e. type hints were successfully resolves).
This is a private property, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005569da015a80, ), serializer: Fields( GeneralFieldsSerializer { fields: { "benchmark_num_samples": SerField { key_py: Py( 0x00007f8560ea3190, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c270070, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "batch_size": SerField { key_py: Py( 0x00007f8560eaa1b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a00f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "random_start": SerField { key_py: Py( 0x00007f8560eaa330, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00005569c2101580, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "n_jobs": SerField { key_py: Py( 0x00007f8560eaa1f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a00b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "mols_to_sample": SerField { key_py: Py( 0x00007f8560eaa270, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c2700b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "n_epochs": SerField { key_py: Py( 0x00007f8560eaa230, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "keep_top": SerField { key_py: Py( 0x00007f8560eaa2b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c270290, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "algorithm_version": SerField { key_py: Py( 0x00007f8560ea30a0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c298a30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "optimize_n_epochs": SerField { key_py: Py( 0x00007f8560ea30f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "optimize_batch_size": SerField { key_py: Py( 0x00007f8560ea3140, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a20d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "max_len": SerField { key_py: Py( 0x00007f8560eaa2f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 11, }, ), fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c2983b0, ), Py( 0x00007f863c29aab0, ), Py( 0x00007f863c29ac70, ), Py( 0x00007f863c29ad70, ), Py( 0x00007f863c2ac210, ), Py( 0x00007f863f9153b0, ), Py( 0x00007f863c2ac2b0, ), Py( 0x00007f863c2ac300, ), Py( 0x00007f863c2987b0, ), ], name: "SMILESLSTMHCGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="SMILESLSTMHCGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f863c2ac030, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "algorithm_version", py_key: Py( 0x00007f8560ea2f60, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c298a30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f863c299270, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "batch_size", py_key: Py( 0x00007f8560ea93f0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a00f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", py_name: Py( 0x00007f863c2983b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_jobs", py_key: Py( 0x00007f8560ea9cb0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a00b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_epochs", py_name: Py( 0x00007f863c29aab0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_epochs", py_key: Py( 0x00007f8560eaa070, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "mols_to_sample", py_name: Py( 0x00007f863c29ac70, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "mols_to_sample", py_key: Py( 0x00007f8560eaa0b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c2700b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "keep_top", py_name: Py( 0x00007f863c29ad70, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "keep_top", py_key: Py( 0x00007f8560eaa0f0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c270290, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "optimize_n_epochs", py_name: Py( 0x00007f863c2ac210, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "optimize_n_epochs", py_key: Py( 0x00007f8560ea2fb0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", py_name: Py( 0x00007f863f9153b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "max_len", py_key: Py( 0x00007f8560eaa130, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "optimize_batch_size", py_name: Py( 0x00007f863c2ac2b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "optimize_batch_size", py_key: Py( 0x00007f8560ea3000, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a20d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "benchmark_num_samples", py_name: Py( 0x00007f863c2ac300, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "benchmark_num_samples", py_key: Py( 0x00007f8560ea3050, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c270070, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "random_start", py_name: Py( 0x00007f863c2987b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "random_start", py_key: Py( 0x00007f8560eaa170, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00005569c2101580, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, ], positional_count: 11, init_only_count: None, dataclass_name: "SMILESLSTMHCGenerator", validator_name: "dataclass-args[SMILESLSTMHCGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005569da015a80, ), generic_origin: None, fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c2983b0, ), Py( 0x00007f863c29aab0, ), Py( 0x00007f863c29ac70, ), Py( 0x00007f863c29ad70, ), Py( 0x00007f863c2ac210, ), Py( 0x00007f863f9153b0, ), Py( 0x00007f863c2ac2b0, ), Py( 0x00007f863c2ac300, ), Py( 0x00007f863c2987b0, ), ], post_init: None, revalidate: Never, name: "SMILESLSTMHCGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: str = 'v0', batch_size: int = 1, n_jobs: int = -1, n_epochs: int = 20, mols_to_sample: int = 1024, keep_top: int = 512, optimize_n_epochs: int = 2, max_len: int = 100, optimize_batch_size: int = 256, benchmark_num_samples: int = 4096, random_start: bool = False) -> None>¶
- __wrapped__¶
alias of
SMILESLSTMHCGenerator
- class SMILESLSTMPPOGenerator(*args, **kwargs)[source]¶
Bases:
SMILESLSTMPPOGenerator
,Generic
[T
]Configuration to generate optimizied molecules using recurrent neural networks with hill climbing algorithm
- algorithm_name: ClassVar[str] = 'GuacaMolGenerator'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- algorithm_type: ClassVar[str] = 'conditional_generation'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'materials'¶
General application domain. Hints at input/output types.
- algorithm_version: str = 'v0'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- batch_size: int = 1¶
- num_epochs: int = 20¶
- episode_size: int = 8192¶
- optimize_batch_size: int = 1024¶
- entropy_weight: int = 1¶
- kl_div_weight: int = 10¶
- clip_param: float = 0.2¶
- get_target_description()[source]¶
Get description of the target for generation.
- Return type
Dict
[str
,str
]- Returns
target description.
- get_conditional_generator(resources_path)[source]¶
Instantiate the actual generator implementation.
- Parameters
resources_path (
str
) – local path to model files.- Return type
- Returns
instance with
generate_batch
method for targeted generation.
- classmethod get_filepath_mappings_for_training_pipeline_arguments()[source]¶
Ger filepath mappings for the given training pipeline arguments.
- Parameters
training_pipeline_arguments (
TrainingPipelineArguments
) – training pipeline arguments.- Return type
Dict
[str
,str
]- Returns
a mapping between artifacts’ files and training pipeline’s output files.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'clip_param': <class 'float'>, 'domain': typing.ClassVar[str], 'entropy_weight': <class 'int'>, 'episode_size': <class 'int'>, 'kl_div_weight': <class 'int'>, 'num_epochs': <class 'int'>, 'optimize_batch_size': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='SMILESLSTMPPOGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'clip_param': Field(name='clip_param',type=<class 'float'>,default=0.2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'used for determining how far the new policy is from the old one'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'entropy_weight': Field(name='entropy_weight',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'used for calculating entropy loss'}),kw_only=False,_field_type=_FIELD), 'episode_size': Field(name='episode_size',type=<class 'int'>,default=8192,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of molecules sampled by the policy at the start of a series of ppo updates'}),kw_only=False,_field_type=_FIELD), 'kl_div_weight': Field(name='kl_div_weight',type=<class 'int'>,default=10,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'used for calculating Kullback-Leibler divergence loss'}),kw_only=False,_field_type=_FIELD), 'num_epochs': Field(name='num_epochs',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of epochs to sample'}),kw_only=False,_field_type=_FIELD), 'optimize_batch_size': Field(name='optimize_batch_size',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'batch size for the optimization'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimizied molecules using recurrent neural networks with hill climbing algorithm'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'num_epochs', 'episode_size', 'optimize_batch_size', 'entropy_weight', 'kl_div_weight', 'clip_param')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.SMILESLSTMPPOGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.SMILESLSTMPPOGenerator'>, 'config': {'title': 'SMILESLSTMPPOGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'num_epochs', 'episode_size', 'optimize_batch_size', 'entropy_weight', 'kl_div_weight', 'clip_param'], 'frozen': False, 'post_init': False, 'ref': 'types.SMILESLSTMPPOGenerator:93913117724848', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'SMILESLSTMPPOGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'num_epochs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of epochs to sample'}}}, {'type': 'dataclass-field', 'name': 'episode_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 8192}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of molecules sampled by the policy at the start of a series of ppo updates'}}}, {'type': 'dataclass-field', 'name': 'optimize_batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'entropy_weight', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'used for calculating entropy loss'}}}, {'type': 'dataclass-field', 'name': 'kl_div_weight', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 10}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'used for calculating Kullback-Leibler divergence loss'}}}, {'type': 'dataclass-field', 'name': 'clip_param', 'schema': {'type': 'default', 'schema': {'type': 'float'}, 'default': 0.2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'used for determining how far the new policy is from the old one'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=1, description='Batch size used for the generative model sampling.', init=True, init_var=False, kw_only=False), 'clip_param': FieldInfo(annotation=float, required=False, default=0.2, description='used for determining how far the new policy is from the old one', init=True, init_var=False, kw_only=False), 'entropy_weight': FieldInfo(annotation=int, required=False, default=1, description='used for calculating entropy loss', init=True, init_var=False, kw_only=False), 'episode_size': FieldInfo(annotation=int, required=False, default=8192, description='number of molecules sampled by the policy at the start of a series of ppo updates', init=True, init_var=False, kw_only=False), 'kl_div_weight': FieldInfo(annotation=int, required=False, default=10, description='used for calculating Kullback-Leibler divergence loss', init=True, init_var=False, kw_only=False), 'num_epochs': FieldInfo(annotation=int, required=False, default=20, description='number of epochs to sample', init=True, init_var=False, kw_only=False), 'optimize_batch_size': FieldInfo(annotation=int, required=False, default=1024, description='batch size for the optimization', init=True, init_var=False, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields where successfully collected (i.e. type hints were successfully resolves).
This is a private property, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005569da0590b0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "num_epochs": SerField { key_py: Py( 0x00007f8560ec3030, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "batch_size": SerField { key_py: Py( 0x00007f8560ec2ff0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a00f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "optimize_batch_size": SerField { key_py: Py( 0x00007f8560ec7690, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c2700b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "episode_size": SerField { key_py: Py( 0x00007f8560ec3070, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c2700d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "entropy_weight": SerField { key_py: Py( 0x00007f8560ec30b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a00f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "kl_div_weight": SerField { key_py: Py( 0x00007f8560ec30f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0210, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "clip_param": SerField { key_py: Py( 0x00007f8560ec3130, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c270610, ), ), serializer: Float( FloatSerializer { inf_nan_mode: Null, }, ), }, ), ), required: true, serialize_by_alias: None, }, "algorithm_version": SerField { key_py: Py( 0x00007f8560ec7640, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c298a30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 8, }, ), fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c29aeb0, ), Py( 0x00007f863c2997f0, ), Py( 0x00007f863c2ac2b0, ), Py( 0x00007f863c29b1f0, ), Py( 0x00007f863c29b230, ), Py( 0x00007f863c29b2b0, ), ], name: "SMILESLSTMPPOGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="SMILESLSTMPPOGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f863c2ac030, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "algorithm_version", py_key: Py( 0x00007f8560ec75a0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c298a30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f863c299270, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "batch_size", py_key: Py( 0x00007f8560ec1cf0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a00f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "num_epochs", py_name: Py( 0x00007f863c29aeb0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "num_epochs", py_key: Py( 0x00007f8560ec2cf0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "episode_size", py_name: Py( 0x00007f863c2997f0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "episode_size", py_key: Py( 0x00007f8560ec2ef0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c2700d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "optimize_batch_size", py_name: Py( 0x00007f863c2ac2b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "optimize_batch_size", py_key: Py( 0x00007f8560ec75f0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c2700b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "entropy_weight", py_name: Py( 0x00007f863c29b1f0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "entropy_weight", py_key: Py( 0x00007f8560ec2f30, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a00f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "kl_div_weight", py_name: Py( 0x00007f863c29b230, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "kl_div_weight", py_key: Py( 0x00007f8560ec2f70, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0210, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "clip_param", py_name: Py( 0x00007f863c29b2b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "clip_param", py_key: Py( 0x00007f8560ec2fb0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c270610, ), ), on_error: Raise, validator: Float( FloatValidator { strict: false, allow_inf_nan: true, }, ), validate_default: false, copy_default: false, name: "default[float]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, ], positional_count: 8, init_only_count: None, dataclass_name: "SMILESLSTMPPOGenerator", validator_name: "dataclass-args[SMILESLSTMPPOGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005569da0590b0, ), generic_origin: None, fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c299270, ), Py( 0x00007f863c29aeb0, ), Py( 0x00007f863c2997f0, ), Py( 0x00007f863c2ac2b0, ), Py( 0x00007f863c29b1f0, ), Py( 0x00007f863c29b230, ), Py( 0x00007f863c29b2b0, ), ], post_init: None, revalidate: Never, name: "SMILESLSTMPPOGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: str = 'v0', batch_size: int = 1, num_epochs: int = 20, episode_size: int = 8192, optimize_batch_size: int = 1024, entropy_weight: int = 1, kl_div_weight: int = 10, clip_param: float = 0.2) -> None>¶
- __wrapped__¶
alias of
SMILESLSTMPPOGenerator
- class MosesGenerator(configuration, target)[source]¶
Bases:
GeneratorAlgorithm
[S
,T
]Moses generation algorithm.
- __init__(configuration, target)[source]¶
Instantiate GuacaMolGenerator ready to generate samples.
- Parameters
configuration (
AlgorithmConfiguration
[~S, ~T]) – domain and application specification defining parameters, types and validations.target (
Optional
[~T,None
]) – a target for which to generate items.
Example
An example for generating molecules given a scoring function and a score:
config = AaeGenerator() algorithm = MosesGenerator(configuration=config, target=””) items = list(algorithm.sample(1)) print(items)
- get_generator(configuration, target)[source]¶
Get the function to perform the prediction via GuacaMol’s generator.
- Parameters
configuration (
AlgorithmConfiguration
[~S, ~T]) – helps to set up specific application of GuacaMol.- Return type
Callable
[[~T],Iterable
[Any
]]- Returns
callable with target generating samples.
- __abstractmethods__ = frozenset({})¶
- __annotations__ = {'generate': 'Untargeted', 'generator': 'Union[Untargeted, Targeted[T]]', 'max_runtime': 'int', 'max_samples': 'int', 'target': 'Optional[T]'}¶
- __doc__ = 'Moses generation algorithm.'¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (gt4sd.algorithms.core.GeneratorAlgorithm[~S, ~T],)¶
- __parameters__ = (~S, ~T)¶
- _abc_impl = <_abc._abc_data object>¶
- class AaeGenerator(*args, **kwargs)[source]¶
Bases:
AaeGenerator
,Generic
[T
]Configuration to generate molecules using an adversarial autoencoder.
- algorithm_name: ClassVar[str] = 'MosesGenerator'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- algorithm_type: ClassVar[str] = 'conditional_generation'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'materials'¶
General application domain. Hints at input/output types.
- algorithm_version: str = 'v0'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- n_samples: int = 20¶
- n_batch: int = 1024¶
- max_len: int = 100¶
- get_conditional_generator(resources_path)[source]¶
Instantiate the actual generator implementation.
- Parameters
resources_path (
str
) – local path to model files.- Return type
- Returns
instance with
generate_batch
method for targeted generation.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'domain': typing.ClassVar[str], 'max_len': <class 'int'>, 'n_batch': <class 'int'>, 'n_samples': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='AaeGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='MosesGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'max_len': Field(name='max_len',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Maximum length of the generated SMILES'}),kw_only=False,_field_type=_FIELD), 'n_batch': Field(name='n_batch',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size for the optimization'}),kw_only=False,_field_type=_FIELD), 'n_samples': Field(name='n_samples',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Number of SMILES to generate'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate molecules using an adversarial autoencoder.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'n_samples', 'n_batch', 'max_len')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.AaeGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.AaeGenerator'>, 'config': {'title': 'AaeGenerator'}, 'fields': ['algorithm_version', 'n_samples', 'n_batch', 'max_len'], 'frozen': False, 'post_init': False, 'ref': 'types.AaeGenerator:93913118106912', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'AaeGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'n_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Number of SMILES to generate'}}}, {'type': 'dataclass-field', 'name': 'n_batch', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Maximum length of the generated SMILES'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'max_len': FieldInfo(annotation=int, required=False, default=100, description='Maximum length of the generated SMILES', init=True, init_var=False, kw_only=False), 'n_batch': FieldInfo(annotation=int, required=False, default=1024, description='Batch size for the optimization', init=True, init_var=False, kw_only=False), 'n_samples': FieldInfo(annotation=int, required=False, default=20, description='Number of SMILES to generate', init=True, init_var=False, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields where successfully collected (i.e. type hints were successfully resolves).
This is a private property, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005569da0b6520, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key_py: Py( 0x00007f8560ecfe60, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c298a30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "n_samples": SerField { key_py: Py( 0x00007f8560ed2a30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "n_batch": SerField { key_py: Py( 0x00007f8560ed2a70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c2700b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "max_len": SerField { key_py: Py( 0x00007f8560ed2ab0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c29b3b0, ), Py( 0x00007f863c29b8b0, ), Py( 0x00007f863f9153b0, ), ], name: "AaeGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="AaeGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f863c2ac030, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "algorithm_version", py_key: Py( 0x00007f8560ecfdc0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c298a30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_samples", py_name: Py( 0x00007f863c29b3b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_samples", py_key: Py( 0x00007f8560ed1230, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_batch", py_name: Py( 0x00007f863c29b8b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_batch", py_key: Py( 0x00007f8560ed1f70, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c2700b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", py_name: Py( 0x00007f863f9153b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "max_len", py_key: Py( 0x00007f8560ed29b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, ], positional_count: 4, init_only_count: None, dataclass_name: "AaeGenerator", validator_name: "dataclass-args[AaeGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005569da0b6520, ), generic_origin: None, fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c29b3b0, ), Py( 0x00007f863c29b8b0, ), Py( 0x00007f863f9153b0, ), ], post_init: None, revalidate: Never, name: "AaeGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: str = 'v0', n_samples: int = 20, n_batch: int = 1024, max_len: int = 100) -> None>¶
- __wrapped__¶
alias of
AaeGenerator
- class VaeGenerator(*args, **kwargs)[source]¶
Bases:
VaeGenerator
,Generic
[T
]Configuration to generate molecules using a variational autoencoder.
- algorithm_name: ClassVar[str] = 'MosesGenerator'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- algorithm_type: ClassVar[str] = 'conditional_generation'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'materials'¶
General application domain. Hints at input/output types.
- algorithm_version: str = 'v0'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- n_samples: int = 20¶
- n_batch: int = 1024¶
- max_len: int = 100¶
- get_conditional_generator(resources_path)[source]¶
Instantiate the actual generator implementation.
- Parameters
resources_path (
str
) – local path to model files.- Return type
- Returns
instance with
generate_batch
method for targeted generation.
- classmethod get_filepath_mappings_for_training_pipeline_arguments()[source]¶
Ger filepath mappings for the given training pipeline arguments.
- Parameters
training_pipeline_arguments (
TrainingPipelineArguments
) – training pipeline arguments.- Return type
Dict
[str
,str
]- Returns
a mapping between artifacts’ files and training pipeline’s output files.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'domain': typing.ClassVar[str], 'max_len': <class 'int'>, 'n_batch': <class 'int'>, 'n_samples': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='VaeGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='MosesGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'max_len': Field(name='max_len',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Maximum length of the generated SMILES'}),kw_only=False,_field_type=_FIELD), 'n_batch': Field(name='n_batch',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size for the optimization'}),kw_only=False,_field_type=_FIELD), 'n_samples': Field(name='n_samples',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Number of SMILES to generate'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate molecules using a variational autoencoder.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'n_samples', 'n_batch', 'max_len')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.VaeGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.VaeGenerator'>, 'config': {'title': 'VaeGenerator'}, 'fields': ['algorithm_version', 'n_samples', 'n_batch', 'max_len'], 'frozen': False, 'post_init': False, 'ref': 'types.VaeGenerator:93913118026224', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'VaeGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'n_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Number of SMILES to generate'}}}, {'type': 'dataclass-field', 'name': 'n_batch', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Maximum length of the generated SMILES'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'max_len': FieldInfo(annotation=int, required=False, default=100, description='Maximum length of the generated SMILES', init=True, init_var=False, kw_only=False), 'n_batch': FieldInfo(annotation=int, required=False, default=1024, description='Batch size for the optimization', init=True, init_var=False, kw_only=False), 'n_samples': FieldInfo(annotation=int, required=False, default=20, description='Number of SMILES to generate', init=True, init_var=False, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields where successfully collected (i.e. type hints were successfully resolves).
This is a private property, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005569da0a29f0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "n_samples": SerField { key_py: Py( 0x00007f8560edcdb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "n_batch": SerField { key_py: Py( 0x00007f8560edcdf0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c2700b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "max_len": SerField { key_py: Py( 0x00007f8560edce30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "algorithm_version": SerField { key_py: Py( 0x00007f8560ed6650, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c298a30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c29b3b0, ), Py( 0x00007f863c29b8b0, ), Py( 0x00007f863f9153b0, ), ], name: "VaeGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="VaeGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f863c2ac030, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "algorithm_version", py_key: Py( 0x00007f8560ed65b0, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c298a30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_samples", py_name: Py( 0x00007f863c29b3b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_samples", py_key: Py( 0x00007f8560edc670, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_batch", py_name: Py( 0x00007f863c29b8b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_batch", py_key: Py( 0x00007f8560edcc30, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c2700b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", py_name: Py( 0x00007f863f9153b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "max_len", py_key: Py( 0x00007f8560edcd30, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, ], positional_count: 4, init_only_count: None, dataclass_name: "VaeGenerator", validator_name: "dataclass-args[VaeGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005569da0a29f0, ), generic_origin: None, fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c29b3b0, ), Py( 0x00007f863c29b8b0, ), Py( 0x00007f863f9153b0, ), ], post_init: None, revalidate: Never, name: "VaeGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: str = 'v0', n_samples: int = 20, n_batch: int = 1024, max_len: int = 100) -> None>¶
- __wrapped__¶
alias of
VaeGenerator
- class OrganGenerator(*args, **kwargs)[source]¶
Bases:
OrganGenerator
,Generic
[T
]Configuration to generate molecules using Objective-Reinforced Generative Adversarial Network
- algorithm_name: ClassVar[str] = 'MosesGenerator'¶
Name of the algorithm to use with this configuration.
Will be set when registering to
ApplicationsRegistry
- algorithm_type: ClassVar[str] = 'conditional_generation'¶
General type of generative algorithm.
- domain: ClassVar[str] = 'materials'¶
General application domain. Hints at input/output types.
- algorithm_version: str = 'v0'¶
To differentiate between different versions of an application.
There is no imposed naming convention.
- n_samples: int = 20¶
- n_batch: int = 1024¶
- max_len: int = 100¶
- get_conditional_generator(resources_path)[source]¶
Instantiate the actual generator implementation.
- Parameters
resources_path (
str
) – local path to model files.- Return type
- Returns
instance with
generate_batch
method for targeted generation.
- classmethod get_filepath_mappings_for_training_pipeline_arguments()[source]¶
Ger filepath mappings for the given training pipeline arguments.
- Parameters
training_pipeline_arguments (
TrainingPipelineArguments
) – training pipeline arguments.- Return type
Dict
[str
,str
]- Returns
a mapping between artifacts’ files and training pipeline’s output files.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'domain': typing.ClassVar[str], 'max_len': <class 'int'>, 'n_batch': <class 'int'>, 'n_samples': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='OrganGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='MosesGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'max_len': Field(name='max_len',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Maximum length of the generated SMILES'}),kw_only=False,_field_type=_FIELD), 'n_batch': Field(name='n_batch',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size for the optimization'}),kw_only=False,_field_type=_FIELD), 'n_samples': Field(name='n_samples',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Number of SMILES to generate'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate molecules using Objective-Reinforced Generative Adversarial Network'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'n_samples', 'n_batch', 'max_len')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.OrganGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.OrganGenerator'>, 'config': {'title': 'OrganGenerator'}, 'fields': ['algorithm_version', 'n_samples', 'n_batch', 'max_len'], 'frozen': False, 'post_init': False, 'ref': 'types.OrganGenerator:93913118004448', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'OrganGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'n_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Number of SMILES to generate'}}}, {'type': 'dataclass-field', 'name': 'n_batch', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Maximum length of the generated SMILES'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'max_len': FieldInfo(annotation=int, required=False, default=100, description='Maximum length of the generated SMILES', init=True, init_var=False, kw_only=False), 'n_batch': FieldInfo(annotation=int, required=False, default=1024, description='Batch size for the optimization', init=True, init_var=False, kw_only=False), 'n_samples': FieldInfo(annotation=int, required=False, default=20, description='Number of SMILES to generate', init=True, init_var=False, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields where successfully collected (i.e. type hints were successfully resolves).
This is a private property, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005569da09d4e0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "n_samples": SerField { key_py: Py( 0x00007f8560ed2db0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "max_len": SerField { key_py: Py( 0x00007f8560ed0870, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f86404a0d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "algorithm_version": SerField { key_py: Py( 0x00007f8560ecd520, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c298a30, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, "n_batch": SerField { key_py: Py( 0x00007f8560ed0bf0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f863c2700b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c29b3b0, ), Py( 0x00007f863c29b8b0, ), Py( 0x00007f863f9153b0, ), ], name: "OrganGenerator", }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="OrganGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", py_name: Py( 0x00007f863c2ac030, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "algorithm_version", py_key: Py( 0x00007f8560ecd480, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c298a30, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_samples", py_name: Py( 0x00007f863c29b3b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_samples", py_key: Py( 0x00007f856107c670, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_batch", py_name: Py( 0x00007f863c29b8b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "n_batch", py_key: Py( 0x00007f8560ed3370, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f863c2700b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", py_name: Py( 0x00007f863f9153b0, ), init: true, init_only: false, lookup_key_collection: LookupKeyCollection { by_name: Simple( LookupPath { first_item: PathItemString { key: "max_len", py_key: Py( 0x00007f8560ed2b70, ), }, rest: [], }, ), by_alias: None, by_alias_then_name: None, }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f86404a0d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f863e1e3a60, ), }, ), frozen: false, }, ], positional_count: 4, init_only_count: None, dataclass_name: "OrganGenerator", validator_name: "dataclass-args[OrganGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x00005569da09d4e0, ), generic_origin: None, fields: [ Py( 0x00007f863c2ac030, ), Py( 0x00007f863c29b3b0, ), Py( 0x00007f863c29b8b0, ), Py( 0x00007f863f9153b0, ), ], post_init: None, revalidate: Never, name: "OrganGenerator", frozen: false, slots: true, }, ), definitions=[], cache_strings=True)¶
- __repr__()¶
Return repr(self).
- __signature__ = <Signature (algorithm_version: str = 'v0', n_samples: int = 20, n_batch: int = 1024, max_len: int = 100) -> None>¶
- __wrapped__¶
alias of
OrganGenerator