scalarstop._single_namespace¶
Common utilities for classes that manage hyperparameters.
Module Contents¶
Classes¶
A common base class for classes with hyperparameters. |
- class SingleNamespace(*, hyperparams: Optional[Union[Mapping[str, Any], scalarstop.hyperparams.HyperparamsType]] = None, **kwargs)¶
A common base class for classes with hyperparameters.
Subclasses of this class takes hyperparameters of
HyperparamsTypeand calculates hash-based names of the hyperparameters.- Parameters
hyperparams – The hyperparameters to initialize this class with.
- Hyperparams :Type[scalarstop.hyperparams.HyperparamsType]¶
- classmethod calculate_name(cls, *, hyperparams: Optional[Union[Mapping[str, Any], scalarstop.hyperparams.HyperparamsType]] = None) str¶
Calculate the hashed name of this object, given the hyperparameters.
This classmethod can be used to calculate what an object would be without actually having to call
__init__().
- property hyperparams(self) scalarstop.hyperparams.HyperparamsType¶
Returns a
HyperparamsTypeinstance containing hyperparameters.
- property hyperparams_flat(self) Dict[str, Any]¶
Returns a Python dictionary of “flattened” hyperparameters.
AppendDataBlobobjects modify a “parent”DataBlob, nesting the parent’s Hyperparams within theAppendDataBlob‘s own Hyperparams.This makes it hard to look up a given hyperparams key. A value at
parent_datablob.hyperparams.ais stored atchild_datablob.hyperparams.parent.hyperparams.a.This
hyperparams_flatproperty provides all nested hyperparams keys as a flat Python dictionary. If a childAppendDataBlobhas a hyperparameter key that that conflicts with the parent, the child’s value will overwrite the parent’s value.