Skip to content

nb301

class NB301Config
dataclass
#

Bases: YAHPOConfig

def validate() #

Validate this is a correct config.

Note:#

We don't check conditionals validity

Source code in src/mfpbench/yahpo/benchmarks/nb301.py
@no_type_check
def validate(self) -> None:
    """Validate this is a correct config.

    Note:
    ----
    We don't check conditionals validity
    """
    nodes = list(range(13 + 1))
    cells = ["normal", "reduce"]
    for i, cell in product(nodes, cells):
        attr_name = f"edge_{cell}_{i}"
        attr = getattr(self, attr_name)
        assert attr is None or attr in Choices, attr_name

    choices_3 = ["0_1", "0_2", "1_2"]
    choices_4 = ["0_1", "0_2", "0_3", "1_2", "1_3", "2_3"]
    choices_5 = [
        "0_1",
        "0_2",
        "0_3",
        "0_4",
        "1_2",
        "1_3",
        "1_4",
        "2_3",
        "2_4",
        "3_4",
    ]

    nodes = list(range(3, 5 + 1))
    for i, choices in [(3, choices_3), (4, choices_4), (5, choices_5)]:
        normal_node = f"inputs_node_normal_{i}"
        assert getattr(self, normal_node) in choices

        reduce_node = f"inputs_node_reduce_{i}"
        assert getattr(self, reduce_node) in choices

def from_dict(d)
classmethod
#

Create from a dict or mapping object.

Source code in src/mfpbench/yahpo/benchmarks/nb301.py
@classmethod
def from_dict(cls: type[Self], d: Mapping[str, Any]) -> Self:
    """Create from a dict or mapping object."""
    # We just flatten things because it's way too big of a name
    config = {k.replace(_hp_name_extension, ""): v for k, v in d.items()}
    return cls(**config)

def dict() #

Converts the config to a raw dictionary.

Source code in src/mfpbench/yahpo/benchmarks/nb301.py
def dict(self) -> dict[str, Any]:
    """Converts the config to a raw dictionary."""
    return {
        _hp_name_extension + k: v for k, v in asdict(self).items() if v is not None
    }

class NB301Result
dataclass
#

Bases: YAHPOResult[NB301Config, int]

score: float
prop
#

The score of interest.

error: float
prop
#

The error of interest.

test_score: float
prop
#

The score on the test set.

test_error: float
prop
#

The score on the test set.

val_score: float
prop
#

The score on the validation set.

val_error: float
prop
#

The score on the validation set.

cost: float
prop
#

Time taken in seconds to train the config.