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_batchmethod for targeted generation.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'domain': typing.ClassVar[str], 'gene_size': <class 'int'>, 'generations': <class 'int'>, 'n_jobs': <class 'int'>, 'n_mutations': <class 'int'>, 'patience': <class 'int'>, 'population_size': <class 'int'>, 'random_start': <class 'bool'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='SMILESGAGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=32,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'gene_size': Field(name='gene_size',type=<class 'int'>,default=2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'size of the gene which is used in creation of genes'}),kw_only=False,_field_type=_FIELD), 'generations': Field(name='generations',type=<class 'int'>,default=2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of evolutionary generations'}),kw_only=False,_field_type=_FIELD), 'n_jobs': Field(name='n_jobs',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of concurrently running jobs'}),kw_only=False,_field_type=_FIELD), 'n_mutations': Field(name='n_mutations',type=<class 'int'>,default=200,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used with population size for the initial generation of smiles within the population'}),kw_only=False,_field_type=_FIELD), 'patience': Field(name='patience',type=<class 'int'>,default=4,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used for early stopping if population scores remains the same after generating molecules'}),kw_only=False,_field_type=_FIELD), 'population_size': Field(name='population_size',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used with n_mutations for the initial generation of smiles within the population'}),kw_only=False,_field_type=_FIELD), 'random_start': Field(name='random_start',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimizied molecules using SMILES Genetic algorithm'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'population_size', 'n_mutations', 'n_jobs', 'gene_size', 'random_start', 'generations', 'patience')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.SMILESGAGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.SMILESGAGenerator'>, 'config': {'title': 'SMILESGAGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'population_size', 'n_mutations', 'n_jobs', 'gene_size', 'random_start', 'generations', 'patience'], 'frozen': False, 'post_init': False, 'ref': 'types.SMILESGAGenerator:94818322698096', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'SMILESGAGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 32}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'population_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used with n_mutations for the initial generation of smiles within the population'}}}, {'type': 'dataclass-field', 'name': 'n_mutations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 200}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used with population size for the initial generation of smiles within the population'}}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of concurrently running jobs'}}}, {'type': 'dataclass-field', 'name': 'gene_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'size of the gene which is used in creation of genes'}}}, {'type': 'dataclass-field', 'name': 'random_start', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}}}, {'type': 'dataclass-field', 'name': 'generations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of evolutionary generations'}}}, {'type': 'dataclass-field', 'name': 'patience', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used for early stopping if population scores remains the same after generating molecules'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=32, description='Batch size used for the generative model sampling.', init=True, 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, kw_only=False), 'generations': FieldInfo(annotation=int, required=False, default=2, description='number of evolutionary generations', init=True, kw_only=False), 'n_jobs': FieldInfo(annotation=int, required=False, default=-1, description='number of concurrently running jobs', init=True, 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, 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, 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, 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, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields were successfully collected (i.e. type hints were successfully resolved).
This is a private helper, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c714f70, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c714f70, ), serializer: Dataclass( DataclassSerializer { class: Py( 0x0000563c9c714f70, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key: "algorithm_version", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222afe89f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "gene_size": SerField { key: "gene_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "generations": SerField { key: "generations", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "batch_size": SerField { key: "batch_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3004d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "population_size": SerField { key: "population_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "n_jobs": SerField { key: "n_jobs", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3000b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "random_start": SerField { key: "random_start", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000563c55c1c6c0, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "n_mutations": SerField { key: "n_mutations", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3019d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "patience": SerField { key: "patience", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300150, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 9, }, ), fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe8170, ), Py( 0x00007f222afe8470, ), Py( 0x00007f222afe8cf0, ), Py( 0x00007f222afe83b0, ), Py( 0x00007f222afe8730, ), Py( 0x00007f222afe8030, ), Py( 0x00007f222afe8230, ), ], name: "SMILESGAGenerator", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="SMILESGAGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "algorithm_version", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222afe89f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "batch_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3004d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "population_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "population_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_mutations", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_mutations", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3019d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_jobs", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3000b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "gene_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "gene_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "random_start", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "random_start", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000563c55c1c6c0, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "generations", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "generations", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "patience", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "patience", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300150, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, ], positional_count: 9, init_only_count: None, dataclass_name: "SMILESGAGenerator", validator_name: "dataclass-args[SMILESGAGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x0000563c9c714f70, ), generic_origin: None, fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe8170, ), Py( 0x00007f222afe8470, ), Py( 0x00007f222afe8cf0, ), Py( 0x00007f222afe83b0, ), Py( 0x00007f222afe8730, ), Py( 0x00007f222afe8030, ), Py( 0x00007f222afe8230, ), ], 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_batchmethod for targeted generation.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'domain': typing.ClassVar[str], 'generations': <class 'int'>, 'mutation_rate': <class 'float'>, 'n_jobs': <class 'int'>, 'offspring_size': <class 'int'>, 'patience': <class 'int'>, 'population_size': <class 'int'>, 'random_start': <class 'bool'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='GraphGAGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'generations': Field(name='generations',type=<class 'int'>,default=2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of evolutionary generations'}),kw_only=False,_field_type=_FIELD), 'mutation_rate': Field(name='mutation_rate',type=<class 'float'>,default=0.01,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'frequency of the new mutations in a single gene or organism over time'}),kw_only=False,_field_type=_FIELD), 'n_jobs': Field(name='n_jobs',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of concurrently running jobs'}),kw_only=False,_field_type=_FIELD), 'offspring_size': Field(name='offspring_size',type=<class 'int'>,default=200,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of molecules to select for new population'}),kw_only=False,_field_type=_FIELD), 'patience': Field(name='patience',type=<class 'int'>,default=4,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used for early stopping if population scores remains the same after generating molecules'}),kw_only=False,_field_type=_FIELD), 'population_size': Field(name='population_size',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used with n_mutations for the initial generation of smiles within the population'}),kw_only=False,_field_type=_FIELD), 'random_start': Field(name='random_start',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimizied molecules using Graph-Based Genetic algorithm'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'population_size', 'mutation_rate', 'offspring_size', 'n_jobs', 'random_start', 'generations', 'patience')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.GraphGAGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.GraphGAGenerator'>, 'config': {'title': 'GraphGAGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'population_size', 'mutation_rate', 'offspring_size', 'n_jobs', 'random_start', 'generations', 'patience'], 'frozen': False, 'post_init': False, 'ref': 'types.GraphGAGenerator:94818322699808', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'GraphGAGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'population_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used with n_mutations for the initial generation of smiles within the population'}}}, {'type': 'dataclass-field', 'name': 'mutation_rate', 'schema': {'type': 'default', 'schema': {'type': 'float'}, 'default': 0.01}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'frequency of the new mutations in a single gene or organism over time'}}}, {'type': 'dataclass-field', 'name': 'offspring_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 200}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of molecules to select for new population'}}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of concurrently running jobs'}}}, {'type': 'dataclass-field', 'name': 'random_start', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}}}, {'type': 'dataclass-field', 'name': 'generations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of evolutionary generations'}}}, {'type': 'dataclass-field', 'name': 'patience', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used for early stopping if population scores remains the same after generating molecules'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=1, description='Batch size used for the generative model sampling.', init=True, kw_only=False), 'generations': FieldInfo(annotation=int, required=False, default=2, description='number of evolutionary generations', init=True, 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, kw_only=False), 'n_jobs': FieldInfo(annotation=int, required=False, default=-1, description='number of concurrently running jobs', init=True, kw_only=False), 'offspring_size': FieldInfo(annotation=int, required=False, default=200, description='number of molecules to select for new population', init=True, 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, 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, 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, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields were successfully collected (i.e. type hints were successfully resolved).
This is a private helper, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c715620, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c715620, ), serializer: Dataclass( DataclassSerializer { class: Py( 0x0000563c9c715620, ), serializer: Fields( GeneralFieldsSerializer { fields: { "random_start": SerField { key: "random_start", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000563c55c1c6c0, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "generations": SerField { key: "generations", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "batch_size": SerField { key: "batch_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3000f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "population_size": SerField { key: "population_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "algorithm_version": SerField { key: "algorithm_version", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222afe89f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "offspring_size": SerField { key: "offspring_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3019d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "n_jobs": SerField { key: "n_jobs", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3000b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "mutation_rate": SerField { key: "mutation_rate", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90bf0, ), ), serializer: Float( FloatSerializer { inf_nan_mode: Null, }, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "patience": SerField { key: "patience", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300150, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 9, }, ), fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe8170, ), Py( 0x00007f222afe9970, ), Py( 0x00007f222afe9230, ), Py( 0x00007f222afe8cf0, ), Py( 0x00007f222afe8730, ), Py( 0x00007f222afe8030, ), Py( 0x00007f222afe8230, ), ], name: "GraphGAGenerator", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="GraphGAGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "algorithm_version", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222afe89f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "batch_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3000f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "population_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "population_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "mutation_rate", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "mutation_rate", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90bf0, ), ), on_error: Raise, validator: Float( FloatValidator { strict: false, allow_inf_nan: true, }, ), validate_default: false, copy_default: false, name: "default[float]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "offspring_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "offspring_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3019d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_jobs", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3000b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "random_start", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "random_start", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000563c55c1c6c0, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "generations", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "generations", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "patience", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "patience", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300150, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, ], positional_count: 9, init_only_count: None, dataclass_name: "GraphGAGenerator", validator_name: "dataclass-args[GraphGAGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x0000563c9c715620, ), generic_origin: None, fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe8170, ), Py( 0x00007f222afe9970, ), Py( 0x00007f222afe9230, ), Py( 0x00007f222afe8cf0, ), Py( 0x00007f222afe8730, ), Py( 0x00007f222afe8030, ), Py( 0x00007f222afe8230, ), ], 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_batchmethod for targeted generation.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'domain': typing.ClassVar[str], 'generations': <class 'int'>, 'init_smiles': <class 'str'>, 'max_atoms': <class 'int'>, 'max_children': <class 'int'>, 'n_jobs': <class 'int'>, 'num_sims': <class 'float'>, 'patience': <class 'int'>, 'population_size': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='GraphMCTSGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'generations': Field(name='generations',type=<class 'int'>,default=1000,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of evolutionary generations'}),kw_only=False,_field_type=_FIELD), 'init_smiles': Field(name='init_smiles',type=<class 'str'>,default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'initial SMILES used for generation of states.'}),kw_only=False,_field_type=_FIELD), 'max_atoms': Field(name='max_atoms',type=<class 'int'>,default=60,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'maximum number of atoms to explore to terminal the node state'}),kw_only=False,_field_type=_FIELD), 'max_children': Field(name='max_children',type=<class 'int'>,default=25,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'maximum number of childerns a node could have'}),kw_only=False,_field_type=_FIELD), 'n_jobs': Field(name='n_jobs',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of concurrently running jobs'}),kw_only=False,_field_type=_FIELD), 'num_sims': Field(name='num_sims',type=<class 'float'>,default=40,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of times to traverse the tree'}),kw_only=False,_field_type=_FIELD), 'patience': Field(name='patience',type=<class 'int'>,default=4,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used for early stopping if population scores remains the same after generating molecules'}),kw_only=False,_field_type=_FIELD), 'population_size': Field(name='population_size',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'it is used with n_mutations for the initial generation of smiles within the population'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimizied molecules using Graph-based Genetic Algorithm and Generative Model/Monte Carlo Tree Search for the Exploration of Chemical Space'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'init_smiles', 'population_size', 'n_jobs', 'generations', 'patience', 'num_sims', 'max_children', 'max_atoms')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.GraphMCTSGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.GraphMCTSGenerator'>, 'config': {'title': 'GraphMCTSGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'init_smiles', 'population_size', 'n_jobs', 'generations', 'patience', 'num_sims', 'max_children', 'max_atoms'], 'frozen': False, 'post_init': False, 'ref': 'types.GraphMCTSGenerator:94818322416000', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'GraphMCTSGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'init_smiles', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': ''}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'initial SMILES used for generation of states.'}}}, {'type': 'dataclass-field', 'name': 'population_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used with n_mutations for the initial generation of smiles within the population'}}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of concurrently running jobs'}}}, {'type': 'dataclass-field', 'name': 'generations', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1000}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of evolutionary generations'}}}, {'type': 'dataclass-field', 'name': 'patience', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'it is used for early stopping if population scores remains the same after generating molecules'}}}, {'type': 'dataclass-field', 'name': 'num_sims', 'schema': {'type': 'default', 'schema': {'type': 'float'}, 'default': 40}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of times to traverse the tree'}}}, {'type': 'dataclass-field', 'name': 'max_children', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 25}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'maximum number of childerns a node could have'}}}, {'type': 'dataclass-field', 'name': 'max_atoms', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 60}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'maximum number of atoms to explore to terminal the node state'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=1, description='Batch size used for the generative model sampling.', init=True, kw_only=False), 'generations': FieldInfo(annotation=int, required=False, default=1000, description='number of evolutionary generations', init=True, kw_only=False), 'init_smiles': FieldInfo(annotation=str, required=False, default='', description='initial SMILES used for generation of states.', init=True, 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, kw_only=False), 'max_children': FieldInfo(annotation=int, required=False, default=25, description='maximum number of childerns a node could have', init=True, kw_only=False), 'n_jobs': FieldInfo(annotation=int, required=False, default=-1, description='number of concurrently running jobs', init=True, kw_only=False), 'num_sims': FieldInfo(annotation=float, required=False, default=40, description='number of times to traverse the tree', init=True, 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, 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, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields were successfully collected (i.e. type hints were successfully resolved).
This is a private helper, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c6d0180, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c6d0180, ), serializer: Dataclass( DataclassSerializer { class: Py( 0x0000563c9c6d0180, ), serializer: Fields( GeneralFieldsSerializer { fields: { "max_atoms": SerField { key: "max_atoms", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300850, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "batch_size": SerField { key: "batch_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3000f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "algorithm_version": SerField { key: "algorithm_version", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222afe89f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "patience": SerField { key: "patience", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300150, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "n_jobs": SerField { key: "n_jobs", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3000b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "generations": SerField { key: "generations", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90630, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "population_size": SerField { key: "population_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "max_children": SerField { key: "max_children", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3003f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "num_sims": SerField { key: "num_sims", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3005d0, ), ), serializer: Float( FloatSerializer { inf_nan_mode: Null, }, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "init_smiles": SerField { key: "init_smiles", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f308030, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 10, }, ), fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe8770, ), Py( 0x00007f222afe8170, ), Py( 0x00007f222afe8cf0, ), Py( 0x00007f222afe8030, ), Py( 0x00007f222afe8230, ), Py( 0x00007f222afebeb0, ), Py( 0x00007f222afe9930, ), Py( 0x00007f222afe8130, ), ], name: "GraphMCTSGenerator", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="GraphMCTSGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "algorithm_version", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222afe89f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "batch_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3000f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "init_smiles", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "init_smiles", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f308030, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "population_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "population_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_jobs", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3000b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "generations", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "generations", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90630, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "patience", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "patience", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300150, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "num_sims", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "num_sims", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3005d0, ), ), on_error: Raise, validator: Float( FloatValidator { strict: false, allow_inf_nan: true, }, ), validate_default: false, copy_default: false, name: "default[float]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_children", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "max_children", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3003f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_atoms", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "max_atoms", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300850, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, ], positional_count: 10, init_only_count: None, dataclass_name: "GraphMCTSGenerator", validator_name: "dataclass-args[GraphMCTSGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x0000563c9c6d0180, ), generic_origin: None, fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe8770, ), Py( 0x00007f222afe8170, ), Py( 0x00007f222afe8cf0, ), Py( 0x00007f222afe8030, ), Py( 0x00007f222afe8230, ), Py( 0x00007f222afebeb0, ), Py( 0x00007f222afe9930, ), Py( 0x00007f222afe8130, ), ], 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_batchmethod for targeted generation.
- classmethod get_filepath_mappings_for_training_pipeline_arguments()[source]¶
Ger filepath mappings for the given training pipeline arguments.
- Parameters
training_pipeline_arguments (
TrainingPipelineArguments) – training pipeline arguments.- Return type
Dict[str,str]- Returns
a mapping between artifacts’ files and training pipeline’s output files.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'benchmark_num_samples': <class 'int'>, 'domain': typing.ClassVar[str], 'keep_top': <class 'int'>, 'max_len': <class 'int'>, 'mols_to_sample': <class 'int'>, 'n_epochs': <class 'int'>, 'n_jobs': <class 'int'>, 'optimize_batch_size': <class 'int'>, 'optimize_n_epochs': <class 'int'>, 'random_start': <class 'bool'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='SMILESLSTMHCGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'benchmark_num_samples': Field(name='benchmark_num_samples',type=<class 'int'>,default=4096,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of molecules to generate from final model for the benchmark'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'keep_top': Field(name='keep_top',type=<class 'int'>,default=512,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'maximum length of a SMILES string'}),kw_only=False,_field_type=_FIELD), 'max_len': Field(name='max_len',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'maximum length of a SMILES string'}),kw_only=False,_field_type=_FIELD), 'mols_to_sample': Field(name='mols_to_sample',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'molecules sampled at each step'}),kw_only=False,_field_type=_FIELD), 'n_epochs': Field(name='n_epochs',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of epochs to sample'}),kw_only=False,_field_type=_FIELD), 'n_jobs': Field(name='n_jobs',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of concurrently running jobs'}),kw_only=False,_field_type=_FIELD), 'optimize_batch_size': Field(name='optimize_batch_size',type=<class 'int'>,default=256,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'batch size for the optimization'}),kw_only=False,_field_type=_FIELD), 'optimize_n_epochs': Field(name='optimize_n_epochs',type=<class 'int'>,default=2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of epochs for the optimization'}),kw_only=False,_field_type=_FIELD), 'random_start': Field(name='random_start',type=<class 'bool'>,default=False,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimized molecules using recurrent neural networks with hill climbing algorithm.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'n_jobs', 'n_epochs', 'mols_to_sample', 'keep_top', 'optimize_n_epochs', 'max_len', 'optimize_batch_size', 'benchmark_num_samples', 'random_start')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.SMILESLSTMHCGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.SMILESLSTMHCGenerator'>, 'config': {'title': 'SMILESLSTMHCGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'n_jobs', 'n_epochs', 'mols_to_sample', 'keep_top', 'optimize_n_epochs', 'max_len', 'optimize_batch_size', 'benchmark_num_samples', 'random_start'], 'frozen': False, 'post_init': False, 'ref': 'types.SMILESLSTMHCGenerator:94818322676160', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'SMILESLSTMHCGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'n_jobs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': -1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of concurrently running jobs'}}}, {'type': 'dataclass-field', 'name': 'n_epochs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of epochs to sample'}}}, {'type': 'dataclass-field', 'name': 'mols_to_sample', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'molecules sampled at each step'}}}, {'type': 'dataclass-field', 'name': 'keep_top', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 512}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'maximum length of a SMILES string'}}}, {'type': 'dataclass-field', 'name': 'optimize_n_epochs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of epochs for the optimization'}}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'maximum length of a SMILES string'}}}, {'type': 'dataclass-field', 'name': 'optimize_batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 256}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'benchmark_num_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 4096}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of molecules to generate from final model for the benchmark'}}}, {'type': 'dataclass-field', 'name': 'random_start', 'schema': {'type': 'default', 'schema': {'type': 'bool'}, 'default': False}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'set to True to randomly choose list of SMILES for generating optimizied molecules'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=1, description='Batch size used for the generative model sampling.', init=True, 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, kw_only=False), 'keep_top': FieldInfo(annotation=int, required=False, default=512, description='maximum length of a SMILES string', init=True, kw_only=False), 'max_len': FieldInfo(annotation=int, required=False, default=100, description='maximum length of a SMILES string', init=True, kw_only=False), 'mols_to_sample': FieldInfo(annotation=int, required=False, default=1024, description='molecules sampled at each step', init=True, kw_only=False), 'n_epochs': FieldInfo(annotation=int, required=False, default=20, description='number of epochs to sample', init=True, kw_only=False), 'n_jobs': FieldInfo(annotation=int, required=False, default=-1, description='number of concurrently running jobs', init=True, kw_only=False), 'optimize_batch_size': FieldInfo(annotation=int, required=False, default=256, description='batch size for the optimization', init=True, kw_only=False), 'optimize_n_epochs': FieldInfo(annotation=int, required=False, default=2, description='number of epochs for the optimization', init=True, 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, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields were successfully collected (i.e. type hints were successfully resolved).
This is a private helper, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c70f9c0, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c70f9c0, ), serializer: Dataclass( DataclassSerializer { class: Py( 0x0000563c9c70f9c0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "algorithm_version": SerField { key: "algorithm_version", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222afe89f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "batch_size": SerField { key: "batch_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3000f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "mols_to_sample": SerField { key: "mols_to_sample", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90750, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "keep_top": SerField { key: "keep_top", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90bd0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "optimize_batch_size": SerField { key: "optimize_batch_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3020d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "n_jobs": SerField { key: "n_jobs", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3000b0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "max_len": SerField { key: "max_len", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "benchmark_num_samples": SerField { key: "benchmark_num_samples", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af907d0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "n_epochs": SerField { key: "n_epochs", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "random_start": SerField { key: "random_start", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x0000563c55c1c6c0, ), ), serializer: Bool( BoolSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "optimize_n_epochs": SerField { key: "optimize_n_epochs", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300110, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 11, }, ), fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe8cf0, ), Py( 0x00007f222afea130, ), Py( 0x00007f222afe93b0, ), Py( 0x00007f222afe9570, ), Py( 0x00007f222affb0f0, ), Py( 0x00007f222ea071b0, ), Py( 0x00007f222affb190, ), Py( 0x00007f222affb1e0, ), Py( 0x00007f222afe8730, ), ], name: "SMILESLSTMHCGenerator", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="SMILESLSTMHCGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "algorithm_version", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222afe89f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "batch_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3000f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_jobs", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_jobs", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3000b0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_epochs", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_epochs", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "mols_to_sample", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "mols_to_sample", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90750, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "keep_top", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "keep_top", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90bd0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "optimize_n_epochs", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "optimize_n_epochs", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300110, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "max_len", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "optimize_batch_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "optimize_batch_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3020d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "benchmark_num_samples", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "benchmark_num_samples", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af907d0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "random_start", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "random_start", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x0000563c55c1c6c0, ), ), on_error: Raise, validator: Bool( BoolValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[bool]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, ], positional_count: 11, init_only_count: None, dataclass_name: "SMILESLSTMHCGenerator", validator_name: "dataclass-args[SMILESLSTMHCGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x0000563c9c70f9c0, ), generic_origin: None, fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe8cf0, ), Py( 0x00007f222afea130, ), Py( 0x00007f222afe93b0, ), Py( 0x00007f222afe9570, ), Py( 0x00007f222affb0f0, ), Py( 0x00007f222ea071b0, ), Py( 0x00007f222affb190, ), Py( 0x00007f222affb1e0, ), Py( 0x00007f222afe8730, ), ], 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_batchmethod for targeted generation.
- classmethod get_filepath_mappings_for_training_pipeline_arguments()[source]¶
Ger filepath mappings for the given training pipeline arguments.
- Parameters
training_pipeline_arguments (
TrainingPipelineArguments) – training pipeline arguments.- Return type
Dict[str,str]- Returns
a mapping between artifacts’ files and training pipeline’s output files.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'batch_size': <class 'int'>, 'clip_param': <class 'float'>, 'domain': typing.ClassVar[str], 'entropy_weight': <class 'int'>, 'episode_size': <class 'int'>, 'kl_div_weight': <class 'int'>, 'num_epochs': <class 'int'>, 'optimize_batch_size': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='SMILESLSTMPPOGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='GuacaMolGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'batch_size': Field(name='batch_size',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size used for the generative model sampling.'}),kw_only=False,_field_type=_FIELD), 'clip_param': Field(name='clip_param',type=<class 'float'>,default=0.2,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'used for determining how far the new policy is from the old one'}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'entropy_weight': Field(name='entropy_weight',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'used for calculating entropy loss'}),kw_only=False,_field_type=_FIELD), 'episode_size': Field(name='episode_size',type=<class 'int'>,default=8192,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of molecules sampled by the policy at the start of a series of ppo updates'}),kw_only=False,_field_type=_FIELD), 'kl_div_weight': Field(name='kl_div_weight',type=<class 'int'>,default=10,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'used for calculating Kullback-Leibler divergence loss'}),kw_only=False,_field_type=_FIELD), 'num_epochs': Field(name='num_epochs',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'number of epochs to sample'}),kw_only=False,_field_type=_FIELD), 'optimize_batch_size': Field(name='optimize_batch_size',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'batch size for the optimization'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate optimizied molecules using recurrent neural networks with hill climbing algorithm'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'batch_size', 'num_epochs', 'episode_size', 'optimize_batch_size', 'entropy_weight', 'kl_div_weight', 'clip_param')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.SMILESLSTMPPOGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.SMILESLSTMPPOGenerator'>, 'config': {'title': 'SMILESLSTMPPOGenerator'}, 'fields': ['algorithm_version', 'batch_size', 'num_epochs', 'episode_size', 'optimize_batch_size', 'entropy_weight', 'kl_div_weight', 'clip_param'], 'frozen': False, 'post_init': False, 'ref': 'types.SMILESLSTMPPOGenerator:94818323037888', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'SMILESLSTMPPOGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size used for the generative model sampling.'}}}, {'type': 'dataclass-field', 'name': 'num_epochs', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of epochs to sample'}}}, {'type': 'dataclass-field', 'name': 'episode_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 8192}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'number of molecules sampled by the policy at the start of a series of ppo updates'}}}, {'type': 'dataclass-field', 'name': 'optimize_batch_size', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'entropy_weight', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'used for calculating entropy loss'}}}, {'type': 'dataclass-field', 'name': 'kl_div_weight', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 10}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'used for calculating Kullback-Leibler divergence loss'}}}, {'type': 'dataclass-field', 'name': 'clip_param', 'schema': {'type': 'default', 'schema': {'type': 'float'}, 'default': 0.2}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'used for determining how far the new policy is from the old one'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, kw_only=False), 'batch_size': FieldInfo(annotation=int, required=False, default=1, description='Batch size used for the generative model sampling.', init=True, 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, kw_only=False), 'entropy_weight': FieldInfo(annotation=int, required=False, default=1, description='used for calculating entropy loss', init=True, 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, kw_only=False), 'kl_div_weight': FieldInfo(annotation=int, required=False, default=10, description='used for calculating Kullback-Leibler divergence loss', init=True, kw_only=False), 'num_epochs': FieldInfo(annotation=int, required=False, default=20, description='number of epochs to sample', init=True, kw_only=False), 'optimize_batch_size': FieldInfo(annotation=int, required=False, default=1024, description='batch size for the optimization', init=True, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields were successfully collected (i.e. type hints were successfully resolved).
This is a private helper, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c767ec0, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c767ec0, ), serializer: Dataclass( DataclassSerializer { class: Py( 0x0000563c9c767ec0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "episode_size": SerField { key: "episode_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90650, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "batch_size": SerField { key: "batch_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3000f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "num_epochs": SerField { key: "num_epochs", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "algorithm_version": SerField { key: "algorithm_version", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222afe89f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "entropy_weight": SerField { key: "entropy_weight", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f3000f0, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "optimize_batch_size": SerField { key: "optimize_batch_size", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90750, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "clip_param": SerField { key: "clip_param", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90b50, ), ), serializer: Float( FloatSerializer { inf_nan_mode: Null, }, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "kl_div_weight": SerField { key: "kl_div_weight", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300210, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 8, }, ), fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe99b0, ), Py( 0x00007f222afe9eb0, ), Py( 0x00007f222affb190, ), Py( 0x00007f222afeab70, ), Py( 0x00007f222afea2b0, ), Py( 0x00007f222afe9a70, ), ], name: "SMILESLSTMPPOGenerator", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="SMILESLSTMPPOGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "algorithm_version", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222afe89f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "batch_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "batch_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3000f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "num_epochs", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "num_epochs", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "episode_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "episode_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90650, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "optimize_batch_size", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "optimize_batch_size", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90750, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "entropy_weight", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "entropy_weight", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f3000f0, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "kl_div_weight", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "kl_div_weight", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300210, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "clip_param", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "clip_param", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90b50, ), ), on_error: Raise, validator: Float( FloatValidator { strict: false, allow_inf_nan: true, }, ), validate_default: false, copy_default: false, name: "default[float]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, ], positional_count: 8, init_only_count: None, dataclass_name: "SMILESLSTMPPOGenerator", validator_name: "dataclass-args[SMILESLSTMPPOGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x0000563c9c767ec0, ), generic_origin: None, fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe83f0, ), Py( 0x00007f222afe99b0, ), Py( 0x00007f222afe9eb0, ), Py( 0x00007f222affb190, ), Py( 0x00007f222afeab70, ), Py( 0x00007f222afea2b0, ), Py( 0x00007f222afe9a70, ), ], 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_batchmethod for targeted generation.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'domain': typing.ClassVar[str], 'max_len': <class 'int'>, 'n_batch': <class 'int'>, 'n_samples': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='AaeGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='MosesGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'max_len': Field(name='max_len',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Maximum length of the generated SMILES'}),kw_only=False,_field_type=_FIELD), 'n_batch': Field(name='n_batch',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size for the optimization'}),kw_only=False,_field_type=_FIELD), 'n_samples': Field(name='n_samples',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Number of SMILES to generate'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate molecules using an adversarial autoencoder.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'n_samples', 'n_batch', 'max_len')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.AaeGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.AaeGenerator'>, 'config': {'title': 'AaeGenerator'}, 'fields': ['algorithm_version', 'n_samples', 'n_batch', 'max_len'], 'frozen': False, 'post_init': False, 'ref': 'types.AaeGenerator:94818322577168', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'AaeGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'n_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Number of SMILES to generate'}}}, {'type': 'dataclass-field', 'name': 'n_batch', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Maximum length of the generated SMILES'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, kw_only=False), 'max_len': FieldInfo(annotation=int, required=False, default=100, description='Maximum length of the generated SMILES', init=True, kw_only=False), 'n_batch': FieldInfo(annotation=int, required=False, default=1024, description='Batch size for the optimization', init=True, kw_only=False), 'n_samples': FieldInfo(annotation=int, required=False, default=20, description='Number of SMILES to generate', init=True, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields were successfully collected (i.e. type hints were successfully resolved).
This is a private helper, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c6f7710, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c6f7710, ), serializer: Dataclass( DataclassSerializer { class: Py( 0x0000563c9c6f7710, ), serializer: Fields( GeneralFieldsSerializer { fields: { "n_batch": SerField { key: "n_batch", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90750, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "n_samples": SerField { key: "n_samples", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "algorithm_version": SerField { key: "algorithm_version", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222afe89f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "max_len": SerField { key: "max_len", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe80b0, ), Py( 0x00007f222afe8af0, ), Py( 0x00007f222ea071b0, ), ], name: "AaeGenerator", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="AaeGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "algorithm_version", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222afe89f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_samples", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_samples", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_batch", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_batch", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90750, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "max_len", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, ], positional_count: 4, init_only_count: None, dataclass_name: "AaeGenerator", validator_name: "dataclass-args[AaeGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x0000563c9c6f7710, ), generic_origin: None, fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe80b0, ), Py( 0x00007f222afe8af0, ), Py( 0x00007f222ea071b0, ), ], 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_batchmethod for targeted generation.
- classmethod get_filepath_mappings_for_training_pipeline_arguments()[source]¶
Ger filepath mappings for the given training pipeline arguments.
- Parameters
training_pipeline_arguments (
TrainingPipelineArguments) – training pipeline arguments.- Return type
Dict[str,str]- Returns
a mapping between artifacts’ files and training pipeline’s output files.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'domain': typing.ClassVar[str], 'max_len': <class 'int'>, 'n_batch': <class 'int'>, 'n_samples': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='VaeGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='MosesGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'max_len': Field(name='max_len',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Maximum length of the generated SMILES'}),kw_only=False,_field_type=_FIELD), 'n_batch': Field(name='n_batch',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size for the optimization'}),kw_only=False,_field_type=_FIELD), 'n_samples': Field(name='n_samples',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Number of SMILES to generate'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate molecules using a variational autoencoder.'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'n_samples', 'n_batch', 'max_len')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.VaeGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.VaeGenerator'>, 'config': {'title': 'VaeGenerator'}, 'fields': ['algorithm_version', 'n_samples', 'n_batch', 'max_len'], 'frozen': False, 'post_init': False, 'ref': 'types.VaeGenerator:94818322347696', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'VaeGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'n_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Number of SMILES to generate'}}}, {'type': 'dataclass-field', 'name': 'n_batch', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Maximum length of the generated SMILES'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, kw_only=False), 'max_len': FieldInfo(annotation=int, required=False, default=100, description='Maximum length of the generated SMILES', init=True, kw_only=False), 'n_batch': FieldInfo(annotation=int, required=False, default=1024, description='Batch size for the optimization', init=True, kw_only=False), 'n_samples': FieldInfo(annotation=int, required=False, default=20, description='Number of SMILES to generate', init=True, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields were successfully collected (i.e. type hints were successfully resolved).
This is a private helper, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c6bf6b0, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c6bf6b0, ), serializer: Dataclass( DataclassSerializer { class: Py( 0x0000563c9c6bf6b0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "n_samples": SerField { key: "n_samples", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "algorithm_version": SerField { key: "algorithm_version", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222afe89f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "n_batch": SerField { key: "n_batch", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90750, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "max_len": SerField { key: "max_len", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe80b0, ), Py( 0x00007f222afe8af0, ), Py( 0x00007f222ea071b0, ), ], name: "VaeGenerator", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="VaeGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "algorithm_version", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222afe89f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_samples", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_samples", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_batch", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_batch", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90750, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "max_len", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, ], positional_count: 4, init_only_count: None, dataclass_name: "VaeGenerator", validator_name: "dataclass-args[VaeGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x0000563c9c6bf6b0, ), generic_origin: None, fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe80b0, ), Py( 0x00007f222afe8af0, ), Py( 0x00007f222ea071b0, ), ], 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_batchmethod for targeted generation.
- classmethod get_filepath_mappings_for_training_pipeline_arguments()[source]¶
Ger filepath mappings for the given training pipeline arguments.
- Parameters
training_pipeline_arguments (
TrainingPipelineArguments) – training pipeline arguments.- Return type
Dict[str,str]- Returns
a mapping between artifacts’ files and training pipeline’s output files.
- __annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': typing.ClassVar[str], 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'domain': typing.ClassVar[str], 'max_len': <class 'int'>, 'n_batch': <class 'int'>, 'n_samples': <class 'int'>}¶
- __dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='OrganGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_name': Field(name='algorithm_name',type=typing.ClassVar[str],default='MosesGenerator',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_type': Field(name='algorithm_type',type=typing.ClassVar[str],default='conditional_generation',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'algorithm_version': Field(name='algorithm_version',type=<class 'str'>,default='v0',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'domain': Field(name='domain',type=typing.ClassVar[str],default='materials',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=<dataclasses._MISSING_TYPE object>,_field_type=_FIELD_CLASSVAR), 'max_len': Field(name='max_len',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Maximum length of the generated SMILES'}),kw_only=False,_field_type=_FIELD), 'n_batch': Field(name='n_batch',type=<class 'int'>,default=1024,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Batch size for the optimization'}),kw_only=False,_field_type=_FIELD), 'n_samples': Field(name='n_samples',type=<class 'int'>,default=20,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Number of SMILES to generate'}),kw_only=False,_field_type=_FIELD)}¶
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)¶
- __doc__ = 'Configuration to generate molecules using Objective-Reinforced Generative Adversarial Network'¶
- __eq__(other)¶
Return self==value.
- __hash__ = None¶
- __init__(*args, **kwargs)¶
- __is_pydantic_dataclass__ = True¶
- __match_args__ = ('algorithm_version', 'n_samples', 'n_batch', 'max_len')¶
- __module__ = 'gt4sd.algorithms.conditional_generation.guacamol.core'¶
- __orig_bases__ = (<class 'types.OrganGenerator'>, typing.Generic[~T])¶
- __parameters__ = (~T,)¶
- __pydantic_complete__ = True¶
- __pydantic_config__ = {}¶
- __pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.conditional_generation.guacamol.core.OrganGenerator'>, 'config': {'title': 'OrganGenerator'}, 'fields': ['algorithm_version', 'n_samples', 'n_batch', 'max_len'], 'frozen': False, 'post_init': False, 'ref': 'types.OrganGenerator:94818323024032', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'OrganGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {}}, {'type': 'dataclass-field', 'name': 'n_samples', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 20}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Number of SMILES to generate'}}}, {'type': 'dataclass-field', 'name': 'n_batch', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 1024}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Batch size for the optimization'}}}, {'type': 'dataclass-field', 'name': 'max_len', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_updates': {'description': 'Maximum length of the generated SMILES'}}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}¶
- __pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})¶
- __pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, kw_only=False), 'max_len': FieldInfo(annotation=int, required=False, default=100, description='Maximum length of the generated SMILES', init=True, kw_only=False), 'n_batch': FieldInfo(annotation=int, required=False, default=1024, description='Batch size for the optimization', init=True, kw_only=False), 'n_samples': FieldInfo(annotation=int, required=False, default=20, description='Number of SMILES to generate', init=True, kw_only=False)}¶
- classmethod __pydantic_fields_complete__()¶
Return whether the fields were successfully collected (i.e. type hints were successfully resolved).
This is a private helper, not meant to be used outside Pydantic.
- Return type
bool
- __pydantic_serializer__ = SchemaSerializer(serializer=PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c7648a0, ), serializer: PolymorphismTrampoline( PolymorphismTrampoline { class: Py( 0x0000563c9c7648a0, ), serializer: Dataclass( DataclassSerializer { class: Py( 0x0000563c9c7648a0, ), serializer: Fields( GeneralFieldsSerializer { fields: { "n_batch": SerField { key: "n_batch", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222af90750, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "algorithm_version": SerField { key: "algorithm_version", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222afe89f0, ), ), serializer: Str( StrSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "max_len": SerField { key: "max_len", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300d50, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, "n_samples": SerField { key: "n_samples", alias: None, serializer: Some( WithDefault( WithDefaultSerializer { default: Default( Py( 0x00007f222f300350, ), ), serializer: Int( IntSerializer, ), }, ), ), required: true, serialize_by_alias: None, serialization_exclude_if: None, }, }, computed_fields: Some( ComputedFields( [], ), ), mode: SimpleDict, extra_serializer: None, filter: SchemaFilter { include: None, exclude: None, }, required_fields: 4, }, ), fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe80b0, ), Py( 0x00007f222afe8af0, ), Py( 0x00007f222ea071b0, ), ], name: "OrganGenerator", }, ), enabled_from_config: false, }, ), enabled_from_config: false, }, ), definitions=[])¶
- __pydantic_validator__ = SchemaValidator(title="OrganGenerator", validator=Dataclass( DataclassValidator { strict: false, validator: DataclassArgs( DataclassArgsValidator { fields: [ Field { kw_only: false, name: "algorithm_version", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "algorithm_version", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222afe89f0, ), ), on_error: Raise, validator: Str( StrValidator { strict: false, coerce_numbers_to_str: false, }, ), validate_default: false, copy_default: false, name: "default[str]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_samples", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_samples", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300350, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "n_batch", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "n_batch", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222af90750, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, Field { kw_only: false, name: "max_len", init: true, init_only: false, lookup_path_collection: LookupPathCollection { by_name: LookupPath { first_item: PathItemString( "max_len", ), rest: [], }, by_alias: [], }, validator: WithDefault( WithDefaultValidator { default: Default( Py( 0x00007f222f300d50, ), ), on_error: Raise, validator: Int( IntValidator { strict: false, }, ), validate_default: false, copy_default: false, name: "default[int]", undefined: Py( 0x00007f222cf13af0, ), }, ), frozen: false, }, ], positional_count: 4, init_only_count: None, dataclass_name: "OrganGenerator", validator_name: "dataclass-args[OrganGenerator]", extra_behavior: Ignore, extras_validator: None, loc_by_alias: true, validate_by_alias: None, validate_by_name: None, }, ), class: Py( 0x0000563c9c7648a0, ), generic_origin: None, fields: [ Py( 0x00007f222affaf10, ), Py( 0x00007f222afe80b0, ), Py( 0x00007f222afe8af0, ), Py( 0x00007f222ea071b0, ), ], 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