Skip to content

Config

Configuration for the multiverse analysis.

Attributes:

Name Type Description
dimensions Dict[str, Any]

A dictionary where keys are dimension names and values are lists of possible values for each dimension.

constraints Optional[Dict[str, List[Dict[str, Any]]]]

Optional dictionary where keys are dimension names and values are lists of constraints. Each constraint is a dictionary with: - value: The value of the dimension that the constraint applies to. - allowed_if: A dictionary of dimension-value pairs that must be present for the constraint to be allowed. - forbidden_if: A dictionary of dimension-value pairs that must not be present for the constraint to be allowed. Only one of allowed_if and forbidden_if can be present in a constraint. Example: constraints = { "dimension1": [ { "value": "value1", "allowed_if": {"dimension2": "value2"} }, { "value": "value3", "forbidden_if": {"dimension4": "value4"} } ] }

seed Optional[int]

Optional seed for random number generation.

stop_on_error Optional[bool]

Optional flag to stop on error.

cell_timeout Optional[int]

Optional timeout (in seconds) for each cell in the notebook.

Source code in multiversum/multiverse.py
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@dataclass
class Config:
    """
    Configuration for the multiverse analysis.

    Attributes:
        dimensions: A dictionary where keys are dimension names and values are lists of possible values for each dimension.
        constraints: Optional dictionary where keys are dimension names and values are lists of constraints. Each constraint is a dictionary with:
            - value: The value of the dimension that the constraint applies to.
            - allowed_if: A dictionary of dimension-value pairs that must be present for the constraint to be allowed.
            - forbidden_if: A dictionary of dimension-value pairs that must not be present for the constraint to be allowed.
            Only one of allowed_if and forbidden_if can be present in a constraint.
            Example:
                constraints = {
                    "dimension1": [
                        {
                            "value": "value1",
                            "allowed_if": {"dimension2": "value2"}
                        },
                        {
                            "value": "value3",
                            "forbidden_if": {"dimension4": "value4"}
                        }
                    ]
                }
        seed: Optional seed for random number generation.
        stop_on_error: Optional flag to stop on error.
        cell_timeout: Optional timeout (in seconds) for each cell in the notebook.
    """

    dimensions: Dict[str, Any]
    constraints: Optional[Dict[str, List[Dict[str, Any]]]] = None
    seed: Optional[int] = None
    stop_on_error: Optional[bool] = None
    cell_timeout: Optional[int] = None