Visualization¶
Utilities to quickly render visual diffs between model predictions and references. Useful after evaluation to inspect outputs.
display_with_diff ¶
display_with_diff(
gold: Expr | str,
pred: Expr | str,
var_order: Sequence[Symbol] | None = None,
) -> None
Render "gold" vs. "pred" with strikethrough on mistakes in "pred".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gold
|
Expr | str
|
Ground-truth expression. If a string, it will be parsed as a token
sequence (e.g., "C1 E1 E1 C-3 E0 E7") via |
required |
pred
|
Expr | str
|
Model-predicted expression. If a string, it will be parsed as a token
sequence via |
required |
var_order
|
Sequence[Symbol] | None
|
Variable ordering (important for >2 variables). Inferred if None. Also
passed to |
None
|
Source code in src/calt/io/visualization/comparison_vis.py
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 177 178 179 180 181 | |
load_eval_results ¶
load_eval_results(file_path: str) -> tuple[list[str], list[str]]
Load evaluation results from a JSON file.
The JSON file should contain a list of objects with "generated" and "reference" keys.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the JSON file. |
required |
Returns:
| Type | Description |
|---|---|
tuple[list[str], list[str]]
|
tuple[list[str], list[str]]: A tuple containing two lists: - List of generated texts. - List of reference texts. |
Source code in src/calt/io/visualization/comparison_vis.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |