config
class Config
dataclass
#
A Config used to query a benchmark.
- Include all hyperparams
- Includes the fidelity
- Configuration and generation agnostic
- Immutable to prevent accidental changes during running, mutate with copy and provide arguments as required.
- Easy equality between configs
def from_dict(d)
classmethod
#
Create from a dict or mapping object.
Source code in src/mfpbench/config.py
def from_row(row)
classmethod
#
def dict()
#
def mutate(**kwargs)
#
def copy()
#
def perturb(space, *, seed=None, std=None, categorical_swap_chance=None)
#
Perturb this config.
Add gaussian noise to each hyperparameter. The mean is centered at the current config.
PARAMETER | DESCRIPTION |
---|---|
space |
The space to perturb in
TYPE:
|
seed |
The seed to use for the perturbation
TYPE:
|
std |
A value in [0, 1] representing the fraction of the hyperparameter range to use as the std. If None, will use keep the current value
TYPE:
|
categorical_swap_chance |
The probability that a categorical hyperparameter will be changed If None, will use keep the current value
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The perturbed config |
Source code in src/mfpbench/config.py
def validate()
abstractmethod
#
Validate the config, just useful early on while testing.
RAISES | DESCRIPTION |
---|---|
AssertionError
|
If the config is not valid |
def __eq__(that)
#
Equality is defined in terms of their dictionary repr.
Source code in src/mfpbench/config.py
def set_as_default_prior(configspace)
#
Apply this configuration as a prior on a configspace.
PARAMETER | DESCRIPTION |
---|---|
configspace |
The space to apply this config to
TYPE:
|
Source code in src/mfpbench/config.py
def from_file(path)
classmethod
#
Load a config from a supported file type.
Note:#
Only supports yaml and json for now
Source code in src/mfpbench/config.py
def from_yaml(path)
classmethod
#
def from_json(path)
classmethod
#
def save(path, format=None)
#
Save the config.
PARAMETER | DESCRIPTION |
---|---|
path |
Where to save to. Will infer json or yaml based on filename |
format |
The format to save as. Will use file suffix if not provided
TYPE:
|
Source code in src/mfpbench/config.py
class TabularConfig
dataclass
#
Bases: Config
id: str | None
classvar
attr
#
The id of this config.
Warning
While this is not required for a config, it is likely required to query into a tabular benchmark.
Reasons for this not existing is when you have created this
from_dict
with a dict that does not have
an id key.
def from_row(row)
classmethod
#
def dict(*, with_id=False)
#
As a raw dictionary.
PARAMETER | DESCRIPTION |
---|---|
with_id |
Whether to include the id key
TYPE:
|
def from_dict(d)
classmethod
#
def names()
classmethod
#
def validate()
#
Validate the config, just useful early on while testing.
Not implemented
Does not do anything for Tabular Benchmarks
class GenericTabularConfig
dataclass
#
Bases: TabularConfig
A generic tabular config.
This is useful for adhoc tabular benchmarks and is what they will return, i.e. directly creating a benchmark from TabularBenchmark.