gt4sd.algorithms.controlled_sampling.advanced_manufacturing.core module

Advanced manufacturing algorithms.

Summary

Classes:

AdvancedManufacturing

Advance manufacturing generator algorithm.

CatalystGenerator

Configuration to generate catalysts with a desired binding energy.

Reference

class AdvancedManufacturing(configuration, target)[source]

Bases: GeneratorAlgorithm[S, T]

Advance manufacturing generator algorithm.

__init__(configuration, target)[source]

Instantiate AdvancedManufacturing ready to generate items.

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 small molecules (SMILES) with a target binding energy:

config = CatalystGenerator()
algorithm = AdvancedManufacturing(configuration=config, target=10.0)
items = list(algorithm.sample(10))
print(items)
get_generator(configuration, target)[source]

Get the function to sample batches via AdvancedManufacturing’s generator.

Parameters
  • configuration (AlgorithmConfiguration[~S, ~T]) – helps to set up specific application of AdvancedManufacturing.

  • target (Optional[~T, None]) – context or condition for the generation.

Return type

Callable[[~T], Iterable[Any]]

Returns

callable with target generating a batch of items.

__abstractmethods__ = frozenset({})
__annotations__ = {'generate': 'Untargeted', 'generator': 'Union[Untargeted, Targeted[T]]', 'max_runtime': 'int', 'max_samples': 'int', 'target': 'Optional[T]'}
__doc__ = 'Advance manufacturing generator algorithm.'
__module__ = 'gt4sd.algorithms.controlled_sampling.advanced_manufacturing.core'
__orig_bases__ = (gt4sd.algorithms.core.GeneratorAlgorithm[~S, ~T],)
__parameters__ = (~S, ~T)
_abc_impl = <_abc._abc_data object>
class CatalystGenerator(*args, **kwargs)[source]

Bases: CatalystGenerator, Generic[T]

Configuration to generate catalysts with a desired binding energy.

algorithm_type: ClassVar[str] = 'controlled_sampling'

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.

number_of_points: int = 32
number_of_steps: int = 50
generated_length: int = 100
primer_smiles: str = ''
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

Generator

Returns

instance with generate_batch method for targeted generation.

classmethod get_filepath_mappings_for_training_pipeline_arguments()[source]

Ger filepath mappings for the given training pipeline arguments.

Parameters

training_pipeline_arguments (TrainingPipelineArguments) – training pipeline arguments.

Return type

Dict[str, str]

Returns

a mapping between artifacts’ files and training pipeline’s output files.

__annotations__ = {'algorithm_application': 'ClassVar[str]', 'algorithm_name': 'ClassVar[str]', 'algorithm_type': typing.ClassVar[str], 'algorithm_version': <class 'str'>, 'domain': typing.ClassVar[str], 'generated_length': <class 'int'>, 'number_of_points': <class 'int'>, 'number_of_steps': <class 'int'>, 'primer_smiles': <class 'str'>}
__dataclass_fields__ = {'algorithm_application': Field(name='algorithm_application',type=typing.ClassVar[str],default='CatalystGenerator',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='AdvancedManufacturing',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='controlled_sampling',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), 'generated_length': Field(name='generated_length',type=<class 'int'>,default=100,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Maximum length in tokens of the generated molcules (relates to the SMILES length).'}),kw_only=False,_field_type=_FIELD), 'number_of_points': Field(name='number_of_points',type=<class 'int'>,default=32,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Number of points to sample with the Gaussian Process.'}),kw_only=False,_field_type=_FIELD), 'number_of_steps': Field(name='number_of_steps',type=<class 'int'>,default=50,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Number of optimization steps in the Gaussian Process optimization.'}),kw_only=False,_field_type=_FIELD), 'primer_smiles': Field(name='primer_smiles',type=<class 'str'>,default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'description': 'Primer molecule to initiate the sampling in SMILES format. Defaults to no primer.'}),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 catalysts with a desired binding energy.'
__eq__(other)

Return self==value.

__hash__ = None
__init__(*args, **kwargs)
__match_args__ = ('algorithm_version', 'number_of_points', 'number_of_steps', 'generated_length', 'primer_smiles')
__module__ = 'gt4sd.algorithms.controlled_sampling.advanced_manufacturing.core'
__orig_bases__ = (<class 'types.CatalystGenerator'>, typing.Generic[~T])
__parameters__ = (~T,)
__pydantic_complete__ = True
__pydantic_config__ = {}
__pydantic_core_schema__ = {'cls': <class 'gt4sd.algorithms.controlled_sampling.advanced_manufacturing.core.CatalystGenerator'>, 'config': {'title': 'CatalystGenerator'}, 'fields': ['algorithm_version', 'number_of_points', 'number_of_steps', 'generated_length', 'primer_smiles'], 'frozen': False, 'metadata': {'pydantic_js_annotation_functions': [], 'pydantic_js_functions': [functools.partial(<function modify_model_json_schema>, cls=<class 'gt4sd.algorithms.controlled_sampling.advanced_manufacturing.core.CatalystGenerator'>, title=None)]}, 'post_init': False, 'ref': 'types.CatalystGenerator:94662817388080', 'schema': {'collect_init_only': False, 'computed_fields': [], 'dataclass_name': 'CatalystGenerator', 'fields': [{'type': 'dataclass-field', 'name': 'algorithm_version', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': 'v0'}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'number_of_points', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 32}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'number_of_steps', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 50}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'generated_length', 'schema': {'type': 'default', 'schema': {'type': 'int'}, 'default': 100}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}, {'type': 'dataclass-field', 'name': 'primer_smiles', 'schema': {'type': 'default', 'schema': {'type': 'str'}, 'default': ''}, 'kw_only': False, 'init': True, 'metadata': {'pydantic_js_functions': [], 'pydantic_js_annotation_functions': [<function get_json_schema_update_func.<locals>.json_schema_update_func>]}}], 'type': 'dataclass-args'}, 'slots': True, 'type': 'dataclass'}
__pydantic_decorators__ = DecoratorInfos(validators={}, field_validators={}, root_validators={}, field_serializers={}, model_serializers={}, model_validators={}, computed_fields={})
__pydantic_fields__ = {'algorithm_version': FieldInfo(annotation=str, required=False, default='v0', init=True, init_var=False, kw_only=False), 'generated_length': FieldInfo(annotation=int, required=False, default=100, description='Maximum length in tokens of the generated molcules (relates to the SMILES length).', init=True, init_var=False, kw_only=False), 'number_of_points': FieldInfo(annotation=int, required=False, default=32, description='Number of points to sample with the Gaussian Process.', init=True, init_var=False, kw_only=False), 'number_of_steps': FieldInfo(annotation=int, required=False, default=50, description='Number of optimization steps in the Gaussian Process optimization.', init=True, init_var=False, kw_only=False), 'primer_smiles': FieldInfo(annotation=str, required=False, default='', description='Primer molecule to initiate the sampling in SMILES format. Defaults to no primer.', init=True, init_var=False, kw_only=False)}
__pydantic_serializer__ = SchemaSerializer(serializer=Dataclass(     DataclassSerializer {         class: Py(             0x00005618679a9630,         ),         serializer: Fields(             GeneralFieldsSerializer {                 fields: {                     "number_of_steps": SerField {                         key_py: Py(                             0x00007f1dc54f0370,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f1ea9468710,                                         ),                                     ),                                     serializer: Int(                                         IntSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "primer_smiles": SerField {                         key_py: Py(                             0x00007f1dc54f03b0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f1ea9470030,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "generated_length": SerField {                         key_py: Py(                             0x00007f1dc54e3500,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f1ea9468d50,                                         ),                                     ),                                     serializer: Int(                                         IntSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "number_of_points": SerField {                         key_py: Py(                             0x00007f1dc54e34b0,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f1ea94684d0,                                         ),                                     ),                                     serializer: Int(                                         IntSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                     "algorithm_version": SerField {                         key_py: Py(                             0x00007f1dc54e3460,                         ),                         alias: None,                         alias_py: None,                         serializer: Some(                             WithDefault(                                 WithDefaultSerializer {                                     default: Default(                                         Py(                                             0x00007f1ea52cf3f0,                                         ),                                     ),                                     serializer: Str(                                         StrSerializer,                                     ),                                 },                             ),                         ),                         required: true,                     },                 },                 computed_fields: Some(                     ComputedFields(                         [],                     ),                 ),                 mode: SimpleDict,                 extra_serializer: None,                 filter: SchemaFilter {                     include: None,                     exclude: None,                 },                 required_fields: 5,             },         ),         fields: [             Py(                 0x00007f1ea52ed250,             ),             Py(                 0x00007f1dca93e4c0,             ),             Py(                 0x00007f1dca921870,             ),             Py(                 0x00007f1dca9b95c0,             ),             Py(                 0x00007f1dca923730,             ),         ],         name: "CatalystGenerator",     }, ), definitions=[])
__pydantic_validator__ = SchemaValidator(title="CatalystGenerator", validator=Dataclass(     DataclassValidator {         strict: false,         validator: DataclassArgs(             DataclassArgsValidator {                 fields: [                     Field {                         kw_only: false,                         name: "algorithm_version",                         py_name: Py(                             0x00007f1ea52ed250,                         ),                         init: true,                         init_only: false,                         lookup_key: Simple {                             key: "algorithm_version",                             py_key: Py(                                 0x00007f1dc54e32d0,                             ),                             path: LookupPath(                                 [                                     S(                                         "algorithm_version",                                         Py(                                             0x00007f1dc54e3320,                                         ),                                     ),                                 ],                             ),                         },                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f1ea52cf3f0,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         kw_only: false,                         name: "number_of_points",                         py_name: Py(                             0x00007f1dca93e4c0,                         ),                         init: true,                         init_only: false,                         lookup_key: Simple {                             key: "number_of_points",                             py_key: Py(                                 0x00007f1dc54e3280,                             ),                             path: LookupPath(                                 [                                     S(                                         "number_of_points",                                         Py(                                             0x00007f1dc54e3370,                                         ),                                     ),                                 ],                             ),                         },                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f1ea94684d0,                                     ),                                 ),                                 on_error: Raise,                                 validator: Int(                                     IntValidator {                                         strict: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[int]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         kw_only: false,                         name: "number_of_steps",                         py_name: Py(                             0x00007f1dca921870,                         ),                         init: true,                         init_only: false,                         lookup_key: Simple {                             key: "number_of_steps",                             py_key: Py(                                 0x00007f1dc54e77b0,                             ),                             path: LookupPath(                                 [                                     S(                                         "number_of_steps",                                         Py(                                             0x00007f1dc54f0330,                                         ),                                     ),                                 ],                             ),                         },                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f1ea9468710,                                     ),                                 ),                                 on_error: Raise,                                 validator: Int(                                     IntValidator {                                         strict: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[int]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         kw_only: false,                         name: "generated_length",                         py_name: Py(                             0x00007f1dca9b95c0,                         ),                         init: true,                         init_only: false,                         lookup_key: Simple {                             key: "generated_length",                             py_key: Py(                                 0x00007f1dc54e33c0,                             ),                             path: LookupPath(                                 [                                     S(                                         "generated_length",                                         Py(                                             0x00007f1dc54e3410,                                         ),                                     ),                                 ],                             ),                         },                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f1ea9468d50,                                     ),                                 ),                                 on_error: Raise,                                 validator: Int(                                     IntValidator {                                         strict: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[int]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                     Field {                         kw_only: false,                         name: "primer_smiles",                         py_name: Py(                             0x00007f1dca923730,                         ),                         init: true,                         init_only: false,                         lookup_key: Simple {                             key: "primer_smiles",                             py_key: Py(                                 0x00007f1dc54f02f0,                             ),                             path: LookupPath(                                 [                                     S(                                         "primer_smiles",                                         Py(                                             0x00007f1dc54f02b0,                                         ),                                     ),                                 ],                             ),                         },                         validator: WithDefault(                             WithDefaultValidator {                                 default: Default(                                     Py(                                         0x00007f1ea9470030,                                     ),                                 ),                                 on_error: Raise,                                 validator: Str(                                     StrValidator {                                         strict: false,                                         coerce_numbers_to_str: false,                                     },                                 ),                                 validate_default: false,                                 copy_default: false,                                 name: "default[str]",                                 undefined: Py(                                     0x00007f1ea71db950,                                 ),                             },                         ),                         frozen: false,                     },                 ],                 positional_count: 5,                 init_only_count: None,                 dataclass_name: "CatalystGenerator",                 validator_name: "dataclass-args[CatalystGenerator]",                 extra_behavior: Ignore,                 extras_validator: None,                 loc_by_alias: true,             },         ),         class: Py(             0x00005618679a9630,         ),         fields: [             Py(                 0x00007f1ea52ed250,             ),             Py(                 0x00007f1dca93e4c0,             ),             Py(                 0x00007f1dca921870,             ),             Py(                 0x00007f1dca9b95c0,             ),             Py(                 0x00007f1dca923730,             ),         ],         post_init: None,         revalidate: Never,         name: "CatalystGenerator",         frozen: false,         slots: true,     }, ), definitions=[], cache_strings=True)
__repr__()

Return repr(self).

__signature__ = <Signature (algorithm_version: str = 'v0', number_of_points: int = 32, number_of_steps: int = 50, generated_length: int = 100, primer_smiles: str = '') -> None>
__wrapped__

alias of CatalystGenerator