Data config
Defines the :class:ResultConfig dataclass for describing simulation contexts.
This class encapsulates the parameters that define a simulation run as such :
- the generation models used,
- the number of voters and candidates,
- the rules applied,
- and the number of iterations.
The class provides for adding rules to existing configs, merging configs, and generating labels for results based on their parameters.
ResultConfig
dataclass
¶
Describes the simulation context attached to a result.
Supports single-valued and multi-valued configurations to express metadata.
All collection fields use :class:frozenset for immutability and
light membership checks.
Source code in src/vote_simulation/models/results/result_config.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
description
property
¶
Human-readable description for plot titles.
Automatically switches between singular and plural phrasing depending on how many distinct values are present.
label
property
¶
Base label suitable for directory / file names (excludes rules).
Used for cache keys and data organization directories. Format depends on how many values are set::
"UNI_v101_c3" (single model, voters, candidates)
"IC_UNI_v11_101_c3_14" (multiple values)
When n_iterations is set, appends _i{n_iterations}.
label_with_rules
property
¶
Full label including rules codes (for complete identification).
Format: {base_label}_r{rules_joined}
base_config()
¶
Return a copy with rules_codes cleared (for cache keys based on data params only).
Source code in src/vote_simulation/models/results/result_config.py
from_dict(data)
staticmethod
¶
Deserialize from a {key: csv_string} mapping.
Source code in src/vote_simulation/models/results/result_config.py
matches_base(other)
¶
Check if two configs have identical base parameters (ignoring rules_codes).
Source code in src/vote_simulation/models/results/result_config.py
merge(other)
¶
Return the union of two configs (idempotent & commutative).
Source code in src/vote_simulation/models/results/result_config.py
single(gen_model='', n_voters=0, n_candidates=0, n_iterations=0, rules_codes=None)
staticmethod
¶
Create a config for a single (model, voters, candidates) combo.
Source code in src/vote_simulation/models/results/result_config.py
to_dict()
¶
Serialize to a {key: csv_string} mapping.