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)¶
- __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, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.conditional_generation.guacamol.core.SMILESGAGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.SMILESGAGenerator:94662814577072', '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': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 32}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'population_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_mutations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 200}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'gene_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'random_start', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'generations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'patience', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], '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)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005618676fb1b0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "n_mutations": SerField { key_py: Py( 0x00007f1dcae2ff70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94699d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "gene_size": SerField { key_py: Py( 0x00007f1dcae44030, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcae348f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cf3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "batch_size": SerField { key_py: Py( 0x00007f1dcae2fef0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94684d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "population_size": SerField { key_py: Py( 0x00007f1dcae2ff30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "generations": SerField { key_py: Py( 0x00007f1dcae440b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "patience": SerField { key_py: Py( 0x00007f1dcae440f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468150, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "random_start": SerField { key_py: Py( 0x00007f1dcae44070, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a463580, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, }, "n_jobs": SerField { key_py: Py( 0x00007f1dcae2ffb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94680b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 9, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cd8f0, ), Py( 0x00007f1ea52cd930, ), Py( 0x00007f1ea52cc770, ), Py( 0x00007f1ea52cfe30, ), Py( 0x00007f1ea52cd4f0, ), Py( 0x00007f1ea52cc830, ), Py( 0x00007f1ea52cd8b0, ), ], 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( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae348a0, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcae347b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cf3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f1ea52ccc70, ), init: true, init_only: false, lookup_key: Simple { key: "batch_size", py_key: Py( 0x00007f1dcae2fbb0, ), path: LookupPath( [ S( "batch_size", Py( 0x00007f1dcae2fb70, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94684d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "population_size", py_name: Py( 0x00007f1ea52cd8f0, ), init: true, init_only: false, lookup_key: Simple { key: "population_size", py_key: Py( 0x00007f1dcae2fb30, ), path: LookupPath( [ S( "population_size", Py( 0x00007f1dcae2faf0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_mutations", py_name: Py( 0x00007f1ea52cd930, ), init: true, init_only: false, lookup_key: Simple { key: "n_mutations", py_key: Py( 0x00007f1dcae2fbf0, ), path: LookupPath( [ S( "n_mutations", Py( 0x00007f1dcae2fc30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94699d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", py_name: Py( 0x00007f1ea52cc770, ), init: true, init_only: false, lookup_key: Simple { key: "n_jobs", py_key: Py( 0x00007f1dcae2fc70, ), path: LookupPath( [ S( "n_jobs", Py( 0x00007f1dcae2fcb0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94680b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "gene_size", py_name: Py( 0x00007f1ea52cfe30, ), init: true, init_only: false, lookup_key: Simple { key: "gene_size", py_key: Py( 0x00007f1dcae2fcf0, ), path: LookupPath( [ S( "gene_size", Py( 0x00007f1dcae2fd30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "random_start", py_name: Py( 0x00007f1ea52cd4f0, ), init: true, init_only: false, lookup_key: Simple { key: "random_start", py_key: Py( 0x00007f1dcae2fd70, ), path: LookupPath( [ S( "random_start", Py( 0x00007f1dcae2fdb0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a463580, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "generations", py_name: Py( 0x00007f1ea52cc830, ), init: true, init_only: false, lookup_key: Simple { key: "generations", py_key: Py( 0x00007f1dcae2fdf0, ), path: LookupPath( [ S( "generations", Py( 0x00007f1dcae2fe30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "patience", py_name: Py( 0x00007f1ea52cd8b0, ), init: true, init_only: false, lookup_key: Simple { key: "patience", py_key: Py( 0x00007f1dcae2fe70, ), path: LookupPath( [ S( "patience", Py( 0x00007f1dcae2feb0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468150, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), 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, }, ), class: Py( 0x00005618676fb1b0, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cd8f0, ), Py( 0x00007f1ea52cd930, ), Py( 0x00007f1ea52cc770, ), Py( 0x00007f1ea52cfe30, ), Py( 0x00007f1ea52cd4f0, ), Py( 0x00007f1ea52cc830, ), Py( 0x00007f1ea52cd8b0, ), ], 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)¶
- __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, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.conditional_generation.guacamol.core.GraphGAGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.GraphGAGenerator:94662814574624', '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': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'population_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'mutation_rate', 'schema': {'type': 'default', 'schema': {'type': 'float'}, 'default': 0.01}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'offspring_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 200}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'random_start', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'generations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'patience', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], '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)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005618676fa820, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key_py: Py( 0x00007f1dcae48850, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cf3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "n_jobs": SerField { key_py: Py( 0x00007f1dcae508f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94680b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "generations": SerField { key_py: Py( 0x00007f1dcae50970, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "population_size": SerField { key_py: Py( 0x00007f1dcae50830, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "batch_size": SerField { key_py: Py( 0x00007f1dcae507f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94680f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "patience": SerField { key_py: Py( 0x00007f1dcae509b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468150, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "mutation_rate": SerField { key_py: Py( 0x00007f1dcae50870, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54ef930, ), ), serializer: Float( FloatSerializer { inf_nan_mode: Null, }, ), }, ), ), required: true, }, "offspring_size": SerField { key_py: Py( 0x00007f1dcae508b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94699d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "random_start": SerField { key_py: Py( 0x00007f1dcae50930, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a463580, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 9, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cd8f0, ), Py( 0x00007f1ea52cc170, ), Py( 0x00007f1ea52cd870, ), Py( 0x00007f1ea52cc770, ), Py( 0x00007f1ea52cd4f0, ), Py( 0x00007f1ea52cc830, ), Py( 0x00007f1ea52cd8b0, ), ], 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( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae48800, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcae48710, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cf3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f1ea52ccc70, ), init: true, init_only: false, lookup_key: Simple { key: "batch_size", py_key: Py( 0x00007f1dcae504b0, ), path: LookupPath( [ S( "batch_size", Py( 0x00007f1dcae50470, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94680f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "population_size", py_name: Py( 0x00007f1ea52cd8f0, ), init: true, init_only: false, lookup_key: Simple { key: "population_size", py_key: Py( 0x00007f1dcae50430, ), path: LookupPath( [ S( "population_size", Py( 0x00007f1dcae503f0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "mutation_rate", py_name: Py( 0x00007f1ea52cc170, ), init: true, init_only: false, lookup_key: Simple { key: "mutation_rate", py_key: Py( 0x00007f1dcae504f0, ), path: LookupPath( [ S( "mutation_rate", Py( 0x00007f1dcae50530, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54ef930, ), ), on_error: Raise, validator: Float( FloatValidator { strict: false, allow_inf_nan: true, }, ), validate_default: false, copy_default: false, name: "default[float]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "offspring_size", py_name: Py( 0x00007f1ea52cd870, ), init: true, init_only: false, lookup_key: Simple { key: "offspring_size", py_key: Py( 0x00007f1dcae50570, ), path: LookupPath( [ S( "offspring_size", Py( 0x00007f1dcae505b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94699d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", py_name: Py( 0x00007f1ea52cc770, ), init: true, init_only: false, lookup_key: Simple { key: "n_jobs", py_key: Py( 0x00007f1dcae505f0, ), path: LookupPath( [ S( "n_jobs", Py( 0x00007f1dcae50630, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94680b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "random_start", py_name: Py( 0x00007f1ea52cd4f0, ), init: true, init_only: false, lookup_key: Simple { key: "random_start", py_key: Py( 0x00007f1dcae50670, ), path: LookupPath( [ S( "random_start", Py( 0x00007f1dcae506b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a463580, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "generations", py_name: Py( 0x00007f1ea52cc830, ), init: true, init_only: false, lookup_key: Simple { key: "generations", py_key: Py( 0x00007f1dcae506f0, ), path: LookupPath( [ S( "generations", Py( 0x00007f1dcae50730, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "patience", py_name: Py( 0x00007f1ea52cd8b0, ), init: true, init_only: false, lookup_key: Simple { key: "patience", py_key: Py( 0x00007f1dcae50770, ), path: LookupPath( [ S( "patience", Py( 0x00007f1dcae507b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468150, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), 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, }, ), class: Py( 0x00005618676fa820, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cd8f0, ), Py( 0x00007f1ea52cc170, ), Py( 0x00007f1ea52cd870, ), Py( 0x00007f1ea52cc770, ), Py( 0x00007f1ea52cd4f0, ), Py( 0x00007f1ea52cc830, ), Py( 0x00007f1ea52cd8b0, ), ], 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)¶
- __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, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.conditional_generation.guacamol.core.GraphMCTSGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.GraphMCTSGenerator:94662815087248', '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': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'init_smiles', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': ''}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'population_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'generations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1000}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'patience', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'num_sims', 'schema': {'type': 'default', 'schema': {'type': 'float'}, 'default': 40}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'max_children', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 25}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'max_atoms', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 60}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], '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)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x0000561867777a90, ), serializer: Fields( GeneralFieldsSerializer { fields: { "num_sims": SerField { key_py: Py( 0x00007f1dcae58ff0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94685d0, ), ), serializer: Float( FloatSerializer { inf_nan_mode: Null, }, ), }, ), ), required: true, }, "batch_size": SerField { key_py: Py( 0x00007f1dcae58e70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94680f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "max_children": SerField { key_py: Py( 0x00007f1dcae59030, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94683f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "max_atoms": SerField { key_py: Py( 0x00007f1dcae59070, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468850, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "patience": SerField { key_py: Py( 0x00007f1dcae58fb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468150, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "init_smiles": SerField { key_py: Py( 0x00007f1dcae58eb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9470030, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcae54350, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cf3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "population_size": SerField { key_py: Py( 0x00007f1dcae58ef0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "generations": SerField { key_py: Py( 0x00007f1dcae58f70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54ef7f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "n_jobs": SerField { key_py: Py( 0x00007f1dcae58f30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94680b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 10, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cc570, ), Py( 0x00007f1ea52cd8f0, ), Py( 0x00007f1ea52cc770, ), Py( 0x00007f1ea52cc830, ), Py( 0x00007f1ea52cd8b0, ), Py( 0x00007f1ea52cd170, ), Py( 0x00007f1ea52ccfb0, ), Py( 0x00007f1ea52cc470, ), ], 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( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae54300, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcae54210, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cf3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f1ea52ccc70, ), init: true, init_only: false, lookup_key: Simple { key: "batch_size", py_key: Py( 0x00007f1dcae58ab0, ), path: LookupPath( [ S( "batch_size", Py( 0x00007f1dcae58a70, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94680f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "init_smiles", py_name: Py( 0x00007f1ea52cc570, ), init: true, init_only: false, lookup_key: Simple { key: "init_smiles", py_key: Py( 0x00007f1dcae58a30, ), path: LookupPath( [ S( "init_smiles", Py( 0x00007f1dcae589f0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9470030, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "population_size", py_name: Py( 0x00007f1ea52cd8f0, ), init: true, init_only: false, lookup_key: Simple { key: "population_size", py_key: Py( 0x00007f1dcae58af0, ), path: LookupPath( [ S( "population_size", Py( 0x00007f1dcae58b30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", py_name: Py( 0x00007f1ea52cc770, ), init: true, init_only: false, lookup_key: Simple { key: "n_jobs", py_key: Py( 0x00007f1dcae58b70, ), path: LookupPath( [ S( "n_jobs", Py( 0x00007f1dcae58bb0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94680b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "generations", py_name: Py( 0x00007f1ea52cc830, ), init: true, init_only: false, lookup_key: Simple { key: "generations", py_key: Py( 0x00007f1dcae58bf0, ), path: LookupPath( [ S( "generations", Py( 0x00007f1dcae58c30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54ef7f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "patience", py_name: Py( 0x00007f1ea52cd8b0, ), init: true, init_only: false, lookup_key: Simple { key: "patience", py_key: Py( 0x00007f1dcae58c70, ), path: LookupPath( [ S( "patience", Py( 0x00007f1dcae58cb0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468150, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "num_sims", py_name: Py( 0x00007f1ea52cd170, ), init: true, init_only: false, lookup_key: Simple { key: "num_sims", py_key: Py( 0x00007f1dcae58cf0, ), path: LookupPath( [ S( "num_sims", Py( 0x00007f1dcae58d30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94685d0, ), ), on_error: Raise, validator: Float( FloatValidator { strict: false, allow_inf_nan: true, }, ), validate_default: false, copy_default: false, name: "default[float]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_children", py_name: Py( 0x00007f1ea52ccfb0, ), init: true, init_only: false, lookup_key: Simple { key: "max_children", py_key: Py( 0x00007f1dcae58d70, ), path: LookupPath( [ S( "max_children", Py( 0x00007f1dcae58db0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94683f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_atoms", py_name: Py( 0x00007f1ea52cc470, ), init: true, init_only: false, lookup_key: Simple { key: "max_atoms", py_key: Py( 0x00007f1dcae58df0, ), path: LookupPath( [ S( "max_atoms", Py( 0x00007f1dcae58e30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468850, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), 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, }, ), class: Py( 0x0000561867777a90, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cc570, ), Py( 0x00007f1ea52cd8f0, ), Py( 0x00007f1ea52cc770, ), Py( 0x00007f1ea52cc830, ), Py( 0x00007f1ea52cd8b0, ), Py( 0x00007f1ea52cd170, ), Py( 0x00007f1ea52ccfb0, ), Py( 0x00007f1ea52cc470, ), ], 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)¶
- __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, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.conditional_generation.guacamol.core.SMILESLSTMHCGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.SMILESLSTMHCGenerator:94662815158704', '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': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_epochs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'mols_to_sample', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'keep_top', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 512}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'optimize_n_epochs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'optimize_batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 256}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'benchmark_num_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4096}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'random_start', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], '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)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005618677891b0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "optimize_batch_size": SerField { key_py: Py( 0x00007f1dcae6a5b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea946a0d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "random_start": SerField { key_py: Py( 0x00007f1dcae6fef0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x000056185a463580, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, }, "benchmark_num_samples": SerField { key_py: Py( 0x00007f1dcae6a600, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54ef890, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "n_epochs": SerField { key_py: Py( 0x00007f1dcae6fdf0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "optimize_n_epochs": SerField { key_py: Py( 0x00007f1dcae6a560, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "max_len": SerField { key_py: Py( 0x00007f1dcae6feb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "mols_to_sample": SerField { key_py: Py( 0x00007f1dcae6fe30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54ef390, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "keep_top": SerField { key_py: Py( 0x00007f1dcae6fe70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54ec3d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcae6a510, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cf3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "batch_size": SerField { key_py: Py( 0x00007f1dcae6fd70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94680f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "n_jobs": SerField { key_py: Py( 0x00007f1dcae6fdb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94680b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 11, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cc770, ), Py( 0x00007f1ea52cc4f0, ), Py( 0x00007f1ea52cd3b0, ), Py( 0x00007f1ea52cce30, ), Py( 0x00007f1ea52ed430, ), Py( 0x00007f1ea88e18f0, ), Py( 0x00007f1ea52ed4d0, ), Py( 0x00007f1ea52ed520, ), Py( 0x00007f1ea52cd4f0, ), ], 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( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae6a2e0, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcae6a330, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cf3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f1ea52ccc70, ), init: true, init_only: false, lookup_key: Simple { key: "batch_size", py_key: Py( 0x00007f1dcae6fab0, ), path: LookupPath( [ S( "batch_size", Py( 0x00007f1dcae6fa70, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94680f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", py_name: Py( 0x00007f1ea52cc770, ), init: true, init_only: false, lookup_key: Simple { key: "n_jobs", py_key: Py( 0x00007f1dcae6fa30, ), path: LookupPath( [ S( "n_jobs", Py( 0x00007f1dcae6f9f0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94680b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_epochs", py_name: Py( 0x00007f1ea52cc4f0, ), init: true, init_only: false, lookup_key: Simple { key: "n_epochs", py_key: Py( 0x00007f1dcae6faf0, ), path: LookupPath( [ S( "n_epochs", Py( 0x00007f1dcae6fb30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "mols_to_sample", py_name: Py( 0x00007f1ea52cd3b0, ), init: true, init_only: false, lookup_key: Simple { key: "mols_to_sample", py_key: Py( 0x00007f1dcae6fb70, ), path: LookupPath( [ S( "mols_to_sample", Py( 0x00007f1dcae6fbb0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54ef390, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "keep_top", py_name: Py( 0x00007f1ea52cce30, ), init: true, init_only: false, lookup_key: Simple { key: "keep_top", py_key: Py( 0x00007f1dcae6fbf0, ), path: LookupPath( [ S( "keep_top", Py( 0x00007f1dcae6fc30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54ec3d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "optimize_n_epochs", py_name: Py( 0x00007f1ea52ed430, ), init: true, init_only: false, lookup_key: Simple { key: "optimize_n_epochs", py_key: Py( 0x00007f1dcae6a290, ), path: LookupPath( [ S( "optimize_n_epochs", Py( 0x00007f1dcae6a380, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", py_name: Py( 0x00007f1ea88e18f0, ), init: true, init_only: false, lookup_key: Simple { key: "max_len", py_key: Py( 0x00007f1dcae6fc70, ), path: LookupPath( [ S( "max_len", Py( 0x00007f1dcae6fcb0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "optimize_batch_size", py_name: Py( 0x00007f1ea52ed4d0, ), init: true, init_only: false, lookup_key: Simple { key: "optimize_batch_size", py_key: Py( 0x00007f1dcae6a3d0, ), path: LookupPath( [ S( "optimize_batch_size", Py( 0x00007f1dcae6a420, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea946a0d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "benchmark_num_samples", py_name: Py( 0x00007f1ea52ed520, ), init: true, init_only: false, lookup_key: Simple { key: "benchmark_num_samples", py_key: Py( 0x00007f1dcae6a470, ), path: LookupPath( [ S( "benchmark_num_samples", Py( 0x00007f1dcae6a4c0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54ef890, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "random_start", py_name: Py( 0x00007f1ea52cd4f0, ), init: true, init_only: false, lookup_key: Simple { key: "random_start", py_key: Py( 0x00007f1dcae6fcf0, ), path: LookupPath( [ S( "random_start", Py( 0x00007f1dcae6fd30, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x000056185a463580, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f1ea71db950, ), }, ), 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, }, ), class: Py( 0x00005618677891b0, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cc770, ), Py( 0x00007f1ea52cc4f0, ), Py( 0x00007f1ea52cd3b0, ), Py( 0x00007f1ea52cce30, ), Py( 0x00007f1ea52ed430, ), Py( 0x00007f1ea88e18f0, ), Py( 0x00007f1ea52ed4d0, ), Py( 0x00007f1ea52ed520, ), Py( 0x00007f1ea52cd4f0, ), ], 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)¶
- __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, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.conditional_generation.guacamol.core.SMILESLSTMPPOGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.SMILESLSTMPPOGenerator:94662815278016', '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': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'num_epochs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'episode_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 8192}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'optimize_batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'entropy_weight', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'kl_div_weight', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 10}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'clip_param', 'schema': {'type': 'default', 'schema': {'type': 'float'}, 'default': 0.2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], '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)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005618677a63c0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "kl_div_weight": SerField { key_py: Py( 0x00007f1dcae8dc30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468210, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "num_epochs": SerField { key_py: Py( 0x00007f1dcae8db70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "clip_param": SerField { key_py: Py( 0x00007f1dcae8dc70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54efd90, ), ), serializer: Float( FloatSerializer { inf_nan_mode: Null, }, ), }, ), ), required: true, }, "optimize_batch_size": SerField { key_py: Py( 0x00007f1dcae903a0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54ef390, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "batch_size": SerField { key_py: Py( 0x00007f1dcae8db30, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94680f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "entropy_weight": SerField { key_py: Py( 0x00007f1dcae8dbf0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea94680f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcae90350, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cf3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "episode_size": SerField { key_py: Py( 0x00007f1dcae8dbb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54efdd0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 8, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cc370, ), Py( 0x00007f1ea52cc2b0, ), Py( 0x00007f1ea52ed4d0, ), Py( 0x00007f1ea52cc930, ), Py( 0x00007f1ea52cd3f0, ), Py( 0x00007f1ea52cd430, ), ], 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( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae90260, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcae902b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cf3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", py_name: Py( 0x00007f1ea52ccc70, ), init: true, init_only: false, lookup_key: Simple { key: "batch_size", py_key: Py( 0x00007f1dcae8d8f0, ), path: LookupPath( [ S( "batch_size", Py( 0x00007f1dcae8d8b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94680f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "num_epochs", py_name: Py( 0x00007f1ea52cc370, ), init: true, init_only: false, lookup_key: Simple { key: "num_epochs", py_key: Py( 0x00007f1dcae8d870, ), path: LookupPath( [ S( "num_epochs", Py( 0x00007f1dcae8ccb0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "episode_size", py_name: Py( 0x00007f1ea52cc2b0, ), init: true, init_only: false, lookup_key: Simple { key: "episode_size", py_key: Py( 0x00007f1dcae8d930, ), path: LookupPath( [ S( "episode_size", Py( 0x00007f1dcae8d970, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54efdd0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "optimize_batch_size", py_name: Py( 0x00007f1ea52ed4d0, ), init: true, init_only: false, lookup_key: Simple { key: "optimize_batch_size", py_key: Py( 0x00007f1dcae90210, ), path: LookupPath( [ S( "optimize_batch_size", Py( 0x00007f1dcae90300, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54ef390, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "entropy_weight", py_name: Py( 0x00007f1ea52cc930, ), init: true, init_only: false, lookup_key: Simple { key: "entropy_weight", py_key: Py( 0x00007f1dcae8d9b0, ), path: LookupPath( [ S( "entropy_weight", Py( 0x00007f1dcae8d9f0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea94680f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "kl_div_weight", py_name: Py( 0x00007f1ea52cd3f0, ), init: true, init_only: false, lookup_key: Simple { key: "kl_div_weight", py_key: Py( 0x00007f1dcae8da30, ), path: LookupPath( [ S( "kl_div_weight", Py( 0x00007f1dcae8da70, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468210, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "clip_param", py_name: Py( 0x00007f1ea52cd430, ), init: true, init_only: false, lookup_key: Simple { key: "clip_param", py_key: Py( 0x00007f1dcae8dab0, ), path: LookupPath( [ S( "clip_param", Py( 0x00007f1dcae8daf0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54efd90, ), ), on_error: Raise, validator: Float( FloatValidator { strict: false, allow_inf_nan: true, }, ), validate_default: false, copy_default: false, name: "default[float]", undefined: Py( 0x00007f1ea71db950, ), }, ), 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, }, ), class: Py( 0x00005618677a63c0, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52ccc70, ), Py( 0x00007f1ea52cc370, ), Py( 0x00007f1ea52cc2b0, ), Py( 0x00007f1ea52ed4d0, ), Py( 0x00007f1ea52cc930, ), Py( 0x00007f1ea52cd3f0, ), Py( 0x00007f1ea52cd430, ), ], 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)¶
- __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, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.conditional_generation.guacamol.core.AaeGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.AaeGenerator:94662814740256', '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': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_batch', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], '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)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x0000561867722f20, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key_py: Py( 0x00007f1dcae9a330, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cf3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "n_samples": SerField { key_py: Py( 0x00007f1dcae9c4b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "n_batch": SerField { key_py: Py( 0x00007f1dcae9c4f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54ef390, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "max_len": SerField { key_py: Py( 0x00007f1dcae9c530, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52cd970, ), Py( 0x00007f1ea52ce6b0, ), Py( 0x00007f1ea88e18f0, ), ], 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( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcae9a380, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcae9a3d0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cf3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_samples", py_name: Py( 0x00007f1ea52cd970, ), init: true, init_only: false, lookup_key: Simple { key: "n_samples", py_key: Py( 0x00007f1dcae9c3f0, ), path: LookupPath( [ S( "n_samples", Py( 0x00007f1dcae9c3b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_batch", py_name: Py( 0x00007f1ea52ce6b0, ), init: true, init_only: false, lookup_key: Simple { key: "n_batch", py_key: Py( 0x00007f1dcae9c370, ), path: LookupPath( [ S( "n_batch", Py( 0x00007f1dcae9c330, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54ef390, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", py_name: Py( 0x00007f1ea88e18f0, ), init: true, init_only: false, lookup_key: Simple { key: "max_len", py_key: Py( 0x00007f1dcae9c430, ), path: LookupPath( [ S( "max_len", Py( 0x00007f1dcae9c470, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), 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, }, ), class: Py( 0x0000561867722f20, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52cd970, ), Py( 0x00007f1ea52ce6b0, ), Py( 0x00007f1ea88e18f0, ), ], 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)¶
- __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, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.conditional_generation.guacamol.core.VaeGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.VaeGenerator:94662815295968', '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': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_batch', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], '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)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x00005618677aa9e0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "n_batch": SerField { key_py: Py( 0x00007f1dcacac3f0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54ef390, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "n_samples": SerField { key_py: Py( 0x00007f1dcacac3b0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcaf2c030, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cf3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "max_len": SerField { key_py: Py( 0x00007f1dcacac430, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52cd970, ), Py( 0x00007f1ea52ce6b0, ), Py( 0x00007f1ea88e18f0, ), ], 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( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcaf2c080, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcaf2c0d0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cf3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_samples", py_name: Py( 0x00007f1ea52cd970, ), init: true, init_only: false, lookup_key: Simple { key: "n_samples", py_key: Py( 0x00007f1dcacac2f0, ), path: LookupPath( [ S( "n_samples", Py( 0x00007f1dcacac2b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_batch", py_name: Py( 0x00007f1ea52ce6b0, ), init: true, init_only: false, lookup_key: Simple { key: "n_batch", py_key: Py( 0x00007f1dcacac270, ), path: LookupPath( [ S( "n_batch", Py( 0x00007f1dcacac1f0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54ef390, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", py_name: Py( 0x00007f1ea88e18f0, ), init: true, init_only: false, lookup_key: Simple { key: "max_len", py_key: Py( 0x00007f1dcacac330, ), path: LookupPath( [ S( "max_len", Py( 0x00007f1dcacac370, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), 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, }, ), class: Py( 0x00005618677aa9e0, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52cd970, ), Py( 0x00007f1ea52ce6b0, ), Py( 0x00007f1ea88e18f0, ), ], 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)¶
- __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, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.conditional_generation.guacamol.core.OrganGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.OrganGenerator:94662814985296', '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': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'n_batch', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], '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)}¶
- __pydantic_serializer__ = SchemaSerializer(serializer=Dataclass( DataclassSerializer { class: Py( 0x000056186775ec50, ), serializer: Fields( GeneralFieldsSerializer { fields: { "n_samples": SerField { key_py: Py( 0x00007f1dcacafdb0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "n_batch": SerField { key_py: Py( 0x00007f1dcacafdf0, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea54ef390, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, "algorithm_version": SerField { key_py: Py( 0x00007f1dcacc1c00, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea52cf3f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, }, "max_len": SerField { key_py: Py( 0x00007f1dcacafe70, ), alias: None, alias_py: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f1ea9468d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52cd970, ), Py( 0x00007f1ea52ce6b0, ), Py( 0x00007f1ea88e18f0, ), ], 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( 0x00007f1ea52ed250, ), init: true, init_only: false, lookup_key: Simple { key: "algorithm_version", py_key: Py( 0x00007f1dcacc1c50, ), path: LookupPath( [ S( "algorithm_version", Py( 0x00007f1dcacc1ca0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea52cf3f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_samples", py_name: Py( 0x00007f1ea52cd970, ), init: true, init_only: false, lookup_key: Simple { key: "n_samples", py_key: Py( 0x00007f1dcacafd30, ), path: LookupPath( [ S( "n_samples", Py( 0x00007f1dcacafd70, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_batch", py_name: Py( 0x00007f1ea52ce6b0, ), init: true, init_only: false, lookup_key: Simple { key: "n_batch", py_key: Py( 0x00007f1dcacafcb0, ), path: LookupPath( [ S( "n_batch", Py( 0x00007f1dcacae2b0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea54ef390, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", py_name: Py( 0x00007f1ea88e18f0, ), init: true, init_only: false, lookup_key: Simple { key: "max_len", py_key: Py( 0x00007f1dcacafc70, ), path: LookupPath( [ S( "max_len", Py( 0x00007f1dcacafcf0, ), ), ], ), }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f1ea9468d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f1ea71db950, ), }, ), 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, }, ), class: Py( 0x000056186775ec50, ), fields: [ Py( 0x00007f1ea52ed250, ), Py( 0x00007f1ea52cd970, ), Py( 0x00007f1ea52ce6b0, ), Py( 0x00007f1ea88e18f0, ), ], 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