Repository navigation
fix(eva): keep the lowest scores in the factor short group - #2380
Divyansh Barodiya (Divyansh151005) wants to merge 5 commits into
Conversation
Equal-count score buckets stopped at the last full group, so the worst names were left out of the short leg whenever the cross-section was not divisible by the group count.
|
Read the diff and traced the 7-name case by hand: sorted high to low the scores are 7,6,5,4,3,2,1, One thing the new docs and docstring should say differently: the buckets are no longer equal-count. With 299 names a day, Two smaller points:
|
The last group is larger when the cross-section does not divide evenly, so the docs no longer call the buckets equal-count. A thin day with fewer names than groups stays all NaN.
The last group is larger when the cross-section does not divide evenly, so the docs no longer call the buckets equal-count. A thin day with fewer names than groups stays all NaN.
The last group is larger when the cross-section does not divide evenly, so the docs no longer call the buckets equal-count. A thin day with fewer names than groups stays all NaN.
The last group is larger when the cross-section does not divide evenly, so the docs no longer call the buckets equal-count. A thin day with fewer names than groups stays all NaN.
|
Thanks for tracing the 7-name case. I pushed a follow-up. The docstring and the report page now say each bucket has
|
1 similar comment
|
Thanks for tracing the 7-name case. I pushed a follow-up. The docstring and the report page now say each bucket has
|
Parafee41 (koriyoshi2041)
left a comment
There was a problem hiding this comment.
Validated the updated head a5a4e28b. The focused file passes 5/5 locally. I also checked a two-date 7-name panel with different score orders: each date retained all names, Group5 matched the bottom-three mean, long-short matched the hand-computed result, and the input frame was unchanged.
The new size == 0 control also preserves the prior all-NaN behavior for undersized cross-sections. The revised docs and changelog now describe the larger remainder bucket accurately. I did not find a remaining correctness issue in this scope.
|
Thanks for re-checking the current head. Nothing further to change in this scope: the remainder stays in the last group, an undersized day stays all NaN, and the docs and changelog describe that larger last bucket. |
Description
The model-performance cumulative-return chart builds equal-count score groups with
after sorting scores from high to low. When the number of names is not divisible by
N, that slice stops before the end of the ranking. The leftover names are the lowest scores, so they never enter the short group.calc_group_returnsnow keeps that remainder in the last group and takes the slice withiloc.Group1is still the highest score.long-shortisGroup1minus the last group, andlong-averagestill subtracts the mean label of the whole cross-section, including names with a missing score. Days that already divide evenly are unchanged.Motivation and Context
Fixes #2379
A 7-name cross-section with 5 groups used to report a short-group return of the 5th-best name. The two worst names were dropped, so the long-short spread was
7 - 3instead of7 - mean(3, 2, 1). That chart is the factor-evaluation view of a model's ranked book.How Has This Been Tested?
pytest qlib/tests/test_all_pipeline.pyunder upper directory ofqlib.test_all_pipeline.pytrains a CSI300 LightGBM workflow and needs the market dataset. These tests build a synthetic score panel.flake8on the changed Python files, with the ignore list from the developer guide, reported no issues.black -l 120reformattedqlib/contrib/eva/alpha.pyand left the other Python files unchanged.Screenshots of Test Results (if appropriate):
tests/misc/test_factor_group_return.py, 4 passed.Types of changes