mlos_bench.tunables.covariant_group module¶
Tunable parameter definition.
- class mlos_bench.tunables.covariant_group.CovariantTunableGroup(name: str, config: dict)¶
Bases:
object
A collection of tunable parameters.
Changing any of the parameters in the group incurs the same cost of the experiment.
- Attributes:
Methods
copy
()Deep copy of the CovariantTunableGroup object.
equals_defaults
(other)Checks to see if the other CovariantTunableGroup is the same, ignoring the current values of the two groups' Tunables.
Get the cost of the experiment given current tunable values.
Get the names of all tunables in the group.
get_tunable
(tunable)Access the entire Tunable in a group (not just its value).
Get current values of all tunables in the group as a dict.
Gets the set of tunables for this CovariantTunableGroup.
Checks whether the currently assigned values of all tunables are at their defaults.
Check if any of the tunable values in the group has been updated.
Clear the update flag.
Restore all tunable parameters to their default values.
- copy() CovariantTunableGroup ¶
Deep copy of the CovariantTunableGroup object.
- Returns:
- groupCovariantTunableGroup
A new instance of the CovariantTunableGroup object that is a deep copy of the original one.
- property cost: int¶
Get the cost of changing the values in the covariant group. This value is a constant. Use get_current_cost() to get the cost given the group update status.
- Returns:
- costint
Cost of changing the values in the covariant group.
- equals_defaults(other: CovariantTunableGroup) bool ¶
Checks to see if the other CovariantTunableGroup is the same, ignoring the current values of the two groups’ Tunables.
- Parameters:
- otherCovariantTunableGroup
A covariant tunable group object to compare to.
- Returns:
- are_equalbool
True if the two CovariantTunableGroup objects’ metadata are the same, False otherwise.
- get_current_cost() int ¶
Get the cost of the experiment given current tunable values.
- Returns:
- costint
Cost of the experiment or 0 if parameters have not been updated.
- get_names() Iterable[str] ¶
Get the names of all tunables in the group.
- get_tunable(tunable: str | Tunable) Tunable ¶
Access the entire Tunable in a group (not just its value). Throw KeyError if the tunable is not in the group.
- Parameters:
- tunablestr
Name of the tunable parameter.
- Returns:
- Tunable
An instance of the Tunable parameter.
- get_tunable_values_dict() Dict[str, int | float | str | None] ¶
Get current values of all tunables in the group as a dict.
- Returns:
- tunablesDict[str, TunableValue]
- get_tunables() Iterable[Tunable] ¶
Gets the set of tunables for this CovariantTunableGroup.
- Returns:
- Iterable[Tunable]
- is_defaults() bool ¶
Checks whether the currently assigned values of all tunables are at their defaults.
- Returns:
- bool
- is_updated() bool ¶
Check if any of the tunable values in the group has been updated.
- Returns:
- is_updatedbool
True if any of the tunable values in the group has been updated, False otherwise.
- property name: str¶
Get the name of the covariant group.
- Returns:
- namestr
Name (i.e., a string id) of the covariant group.
- reset_is_updated() None ¶
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.
- restore_defaults() None ¶
Restore all tunable parameters to their default values.