saealib.register#
- saealib.register(name=None)[ソース]#
Register a class or function under
name(defaultcls.__name__).Use this to make a custom
Algorithm/Surrogate/etc. subclass resolvable by name from a preset YAML file, the same way bundled components are:>>> from saealib import register >>> from saealib.surrogate.base import Surrogate >>> >>> @register() ... class MyCustomSurrogate(Surrogate): ... ...
MyCustomSurrogatecan now be referenced as"MyCustomSurrogate"or{"type": "MyCustomSurrogate", "params": {...}}anywhere a spec is accepted, e.g. in a preset consumed byset_preset().- パラメータ:
name (str | None)
- 戻り値の型:
Callable[[T], T]