Analysis methods
fev
provides 3 main methods for aggregating the evaluation summaries produced by Task.evaluation_summary()
:
pivot_table()
- A table of model scores with tasks as index and model names as columns.leaderboard()
- Aggregate performance for each individual model.pairwise_comparison()
- Aggregate performance for each pair of models.
On this page SummaryType
is an alias for one of the following types:
SummaryType: TypeAlias = pd.DataFrame | list[dict] | str | pathlib.Path
module-attribute
Functions
leaderboard(summaries: SummaryType | list[SummaryType], metric_column: str = 'test_error', missing_strategy: Literal['error', 'drop', 'impute'] = 'error', baseline_model: str = 'seasonal_naive', min_relative_error: float | None = 0.01, max_relative_error: float | None = 100.0, included_models: list[str] | None = None, excluded_models: list[str] | None = None, n_resamples: int | None = None, seed: int = 123)
Generate a leaderboard with aggregate performance metrics for all models.
Computes skill score (1 - geometric mean relative error) and win rate with bootstrap confidence intervals across all tasks. Models are ranked by skill score.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
summaries
|
SummaryType | list[SummaryType]
|
Evaluation summaries as DataFrame, list of dicts, or file path(s) |
required |
metric_column
|
str
|
Column name containing the metric to evaluate |
"test_error"
|
baseline_model
|
str
|
Model name to use for relative error computation |
"SeasonalNaive"
|
missing_strategy
|
Literal['error', 'drop', 'impute']
|
How to handle missing results:
|
"error"
|
min_relative_error
|
float
|
Lower bound for clipping relative errors w.r.t. the |
1e-2
|
max_relative_error
|
float
|
Upper bound for clipping relative errors w.r.t. the |
100
|
included_models
|
list[str]
|
Models to include (mutually exclusive with |
None
|
excluded_models
|
list[str]
|
Models to exclude (mutually exclusive with |
None
|
n_resamples
|
int | None
|
Number of bootstrap samples for confidence intervals. If None, confidence intervals are not computed |
None
|
seed
|
int
|
Random seed for reproducible bootstrap sampling |
123
|
Returns:
Type | Description |
---|---|
DataFrame
|
Leaderboard sorted by
|
Source code in src/fev/analysis.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
|
pairwise_comparison(summaries: SummaryType | list[SummaryType], metric_column: str = 'test_error', missing_strategy: Literal['error', 'drop', 'impute'] = 'error', baseline_model: str | None = None, min_relative_error: float | None = 0.01, max_relative_error: float | None = 100.0, included_models: list[str] | None = None, excluded_models: list[str] | None = None, n_resamples: int | None = None, seed: int = 123) -> pd.DataFrame
Compute pairwise performance comparisons between all model pairs.
For each pair of models, calculates skill score (1 - geometric mean relative error) and win rate with bootstrap confidence intervals across all tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
summaries
|
SummaryType | list[SummaryType]
|
Evaluation summaries as DataFrame, list of dicts, or file path(s) |
required |
metric_column
|
str
|
Column name containing the metric to evaluate |
"test_error"
|
missing_strategy
|
Literal['error', 'drop', 'impute']
|
How to handle missing results:
|
"error"
|
baseline_model
|
str
|
Required only when missing_strategy="impute" |
None
|
min_relative_error
|
float
|
Lower bound for clipping error ratios in pairwise comparisons |
1e-2
|
max_relative_error
|
float
|
Upper bound for clipping error ratios in pairwise comparisons |
100.0
|
included_models
|
list[str]
|
Models to include (mutually exclusive with |
None
|
excluded_models
|
list[str]
|
Models to exclude (mutually exclusive with |
None
|
n_resamples
|
int | None
|
Number of bootstrap samples for confidence intervals. If None, confidence intervals are not computed |
None
|
seed
|
int
|
Random seed for reproducible bootstrap sampling |
123
|
Returns:
Type | Description |
---|---|
DataFrame
|
Pairwise comparison results with
|
Source code in src/fev/analysis.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
pivot_table(summaries: SummaryType | list[SummaryType], metric_column: str = 'test_error', task_columns: str | list[str] = TASK_DEF_COLUMNS.copy(), baseline_model: str | None = None, check_fev_version: bool = False) -> pd.DataFrame
Convert evaluation summaries into a pivot table for analysis.
Creates a matrix where rows represent tasks and columns represent models, with each cell containing the specified metric value. Optionally normalizes all scores relative to a baseline model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
summaries
|
SummaryType | list[SummaryType]
|
Evaluation summaries as DataFrame, list of dicts, or file path(s) |
required |
metric_column
|
str
|
Column name containing the metric to pivot |
"test_error"
|
task_columns
|
str | list[str]
|
Column(s) defining unique tasks. Used as the pivot table index |
TASK_DEF_COLUMNS
|
baseline_model
|
str
|
If provided, divide all scores by this model's scores to get relative performance |
None
|
check_fev_version
|
bool
|
If True, check that fev_version in the summary is >= LAST_BREAKING_VERSION. |
False
|
Returns:
Type | Description |
---|---|
DataFrame
|
Pivot table with task combinations as index and model names as columns.
Values are raw scores or relative scores (if |
Raises:
Type | Description |
---|---|
ValueError
|
If duplicate model/task combinations exist, or results for |
Source code in src/fev/analysis.py
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 182 183 184 185 186 187 188 189 190 191 192 |
|