Bradley-Terry
evalica.bradley_terry(xs, ys, ws, index=None, win_weight=1.0, tie_weight=0.5, solver='pyo3', tolerance=1e-06, limit=100)
Compute the Bradley-Terry scores for the given pairwise comparison.
Quote
Bradley, R.A., Terry, M.E.: Rank Analysis of Incomplete Block Designs: I. The Method of Paired Comparisons. Biometrika. 39, 324–345 (1952). https://doi.org/10.2307/2334029.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xs
|
Collection[T]
|
The left-hand side elements. |
required |
ys
|
Collection[T]
|
The right-hand side elements. |
required |
ws
|
Collection[Winner]
|
The winner elements. |
required |
index
|
dict[T, int] | None
|
The index. |
None
|
win_weight
|
float
|
The win weight. |
1.0
|
tie_weight
|
float
|
The tie weight. |
0.5
|
solver
|
Literal['naive', 'pyo3']
|
The solver. |
'pyo3'
|
tolerance
|
float
|
The convergence tolerance. |
1e-06
|
limit
|
int
|
The maximum number of iterations. |
100
|
Returns:
| Type | Description |
|---|---|
BradleyTerryResult[T]
|
The Bradley-Terry result. |
Source code in evalica/__init__.py
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 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 | |
evalica.BradleyTerryResult
dataclass
Bases: Generic[T]
The Bradley-Terry result.
Attributes:
| Name | Type | Description |
|---|---|---|
scores |
Series[float]
|
The element scores. |
index |
dict[T, int]
|
The index. |
win_weight |
float
|
The win weight. |
tie_weight |
float
|
The tie weight. |
solver |
str
|
The solver. |
tolerance |
float
|
The convergence tolerance. |
iterations |
int
|
The actual number of iterations. |
limit |
int
|
The maximum number of iterations. |
Source code in evalica/__init__.py
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 | |
evalica.newman(xs, ys, ws, index=None, v_init=0.5, win_weight=1.0, tie_weight=1.0, solver='pyo3', tolerance=1e-06, limit=100)
Compute the scores for the given pairwise comparison using the Newman's algorithm.
Quote
Newman, M.E.J.: Efficient Computation of Rankings from Pairwise Comparisons. Journal of Machine Learning Research. 24, 1–25 (2023). https://www.jmlr.org/papers/v24/22-1086.html.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xs
|
Collection[T]
|
The left-hand side elements. |
required |
ys
|
Collection[T]
|
The right-hand side elements. |
required |
ws
|
Collection[Winner]
|
The winner elements. |
required |
index
|
dict[T, int] | None
|
The index. |
None
|
v_init
|
float
|
The initial tie parameter. |
0.5
|
win_weight
|
float
|
The win weight. |
1.0
|
tie_weight
|
float
|
The tie weight. |
1.0
|
solver
|
Literal['naive', 'pyo3']
|
The solver. |
'pyo3'
|
tolerance
|
float
|
The convergence tolerance. |
1e-06
|
limit
|
int
|
The maximum number of iterations. |
100
|
Returns:
| Type | Description |
|---|---|
NewmanResult[T]
|
The Newman's result. |
Source code in evalica/__init__.py
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 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 | |
evalica.NewmanResult
dataclass
Bases: Generic[T]
The Newman's algorithm result.
Attributes:
| Name | Type | Description |
|---|---|---|
scores |
Series[float]
|
The element scores. |
index |
dict[T, int]
|
The index. |
v |
float
|
The tie parameter. |
v_init |
float
|
The initial tie parameter. |
win_weight |
float
|
The win weight. |
tie_weight |
float
|
The tie weight. |
solver |
str
|
The solver. |
tolerance |
float
|
The convergence tolerance. |
iterations |
int
|
The actual number of iterations. |
limit |
int
|
The maximum number of iterations. |
Source code in evalica/__init__.py
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 | |