mlos_bench.tunables.covariant_group
Tunable parameter definition.
Classes
A collection of tunable parameters. |
Module Contents
- class mlos_bench.tunables.covariant_group.CovariantTunableGroup(name: str, config: dict)[source]
A collection of tunable parameters.
Changing any of the parameters in the group incurs the same cost of the experiment.
Create a new group of tunable parameters.
- Parameters:
- __contains__(tunable: str | mlos_bench.tunables.tunable.Tunable) bool [source]
- Parameters:
tunable (Union[str, mlos_bench.tunables.tunable.Tunable])
- Return type:
- __eq__(other: object) bool [source]
Check if two CovariantTunableGroup objects are equal.
- Parameters:
other (CovariantTunableGroup) – A covariant tunable group object to compare to.
- Returns:
is_equal – True if two CovariantTunableGroup objects are equal.
- Return type:
- __getitem__(tunable: str | mlos_bench.tunables.tunable.Tunable) mlos_bench.tunables.tunable.TunableValue [source]
- Parameters:
tunable (Union[str, mlos_bench.tunables.tunable.Tunable])
- Return type:
- __repr__() str [source]
Produce a human-readable version of the CovariantTunableGroup (mostly for logging).
- Returns:
string – A human-readable version of the CovariantTunableGroup.
- Return type:
- __setitem__(tunable: str | mlos_bench.tunables.tunable.Tunable, tunable_value: mlos_bench.tunables.tunable.TunableValue | mlos_bench.tunables.tunable.Tunable) mlos_bench.tunables.tunable.TunableValue [source]
- Parameters:
tunable (Union[str, mlos_bench.tunables.tunable.Tunable])
tunable_value (Union[mlos_bench.tunables.tunable.TunableValue, mlos_bench.tunables.tunable.Tunable])
- Return type:
- copy() CovariantTunableGroup [source]
Deep copy of the CovariantTunableGroup object.
- Returns:
group – A new instance of the CovariantTunableGroup object that is a deep copy of the original one.
- Return type:
- equals_defaults(other: CovariantTunableGroup) bool [source]
Checks to see if the other CovariantTunableGroup is the same, ignoring the current values of the two groups’ Tunables.
- Parameters:
other (CovariantTunableGroup) – A covariant tunable group object to compare to.
- Returns:
are_equal – True if the two CovariantTunableGroup objects’ metadata are the same, False otherwise.
- Return type:
- get_current_cost() int [source]
Get the cost of the experiment given current tunable values.
- Returns:
cost – Cost of the experiment or 0 if parameters have not been updated.
- Return type:
- get_names() Iterable[str] [source]
Get the names of all tunables in the group.
- Return type:
Iterable[str]
- get_tunable(tunable: str | mlos_bench.tunables.tunable.Tunable) mlos_bench.tunables.tunable.Tunable [source]
Access the entire Tunable in a group (not just its value). Throw KeyError if the tunable is not in the group.
- get_tunable_values_dict() Dict[str, mlos_bench.tunables.tunable.TunableValue] [source]
Get current values of all tunables in the group as a dict.
- Returns:
tunables
- Return type:
Dict[str, TunableValue]
- get_tunables() Iterable[mlos_bench.tunables.tunable.Tunable] [source]
Gets the set of tunables for this CovariantTunableGroup.
- Return type:
Iterable[Tunable]
- is_defaults() bool [source]
Checks whether the currently assigned values of all tunables are at their defaults.
- Return type:
- is_updated() bool [source]
Check if any of the tunable values in the group has been updated.
- Returns:
is_updated – True if any of the tunable values in the group has been updated, False otherwise.
- Return type:
- reset_is_updated() None [source]
Clear the update flag.
That is, state that running an experiment with the current values of the tunables in this group has no extra cost.
- Return type:
None
- restore_defaults() None [source]
Restore all tunable parameters to their default values.
- Return type:
None