addons.tune.config
Creates the spock config interface that wraps attr -- tune version for hyper-parameters
_process_class#
def _process_class(cls, kw_only: bool, make_init: bool, dynamic: bool)Process a given class
Arguments:
cls- basic class definitionkw_only- set kwarg onlymake_init- make an init functiondynamic- allows inherited classes to not be @spock decorated
Returns:
cls with attrs dunder methods added
_spock_tune#
def _spock_tune(maybe_cls=None, kw_only=True, make_init=True)Ovverides basic spock_attr decorator with another name
Using a different name allows spock to easily determine which parameters are normal and which are meant to be used in a hyper-parameter tuning backend
Arguments:
maybe_cls- maybe a basic class def maybe None depending on call typekw_only- Make all attributes keyword-onlymake_init- bool, define a init() method
Returns:
cls- attrs class that is frozen and kw only
RangeHyperParameter Objects#
@attr.sclass RangeHyperParameter()Range based hyper-parameter that is sampled uniformly
Attributes:
type- type of the hyper-parameter (note: spock will attempt to autocast into this type)bounds- min and max of the hyper-parameter rangelog_scale- log scale the values before sampling
ChoiceHyperParameter Objects#
@attr.sclass ChoiceHyperParameter()Choice based hyper-parameter that is sampled uniformly
Attributes:
type- type of the hyper-parameter -- (note: spock will attempt to autocast into this type)choices- list of variable length that contains all the possible choices to select from