Commit c17fe6d
committed
fix: Replace unstable qcut with rank-based decile calculation
The `polars.qcut` function was found to produce inconsistently sorted
string-based intervals across different versions of the `polars` library.
This caused incorrect ordering of deciles in the calibration curve plot.
This commit replaces the `qcut` implementation with a more robust,
manual calculation using the `rank()` window function. The new logic,
`((rank - 1) * n_bins // N) + 1`, correctly and consistently
assigns items to their respective deciles, ensuring the calibration
curve is plotted correctly regardless of the `polars` version.1 parent 725e7d7 commit c17fe6d
1 file changed
+10
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
534 | 534 | | |
535 | 535 | | |
536 | 536 | | |
537 | | - | |
538 | | - | |
539 | 537 | | |
540 | 538 | | |
541 | 539 | | |
542 | 540 | | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
547 | 550 | | |
548 | | - | |
| 551 | + | |
549 | 552 | | |
550 | 553 | | |
551 | 554 | | |
| |||
0 commit comments