Docs: clarify equal-weighted portfolio vs cap-weighted benchmark comp… - #2316
Open
taro0915 wants to merge 1 commit into
Open
Docs: clarify equal-weighted portfolio vs cap-weighted benchmark comp…#2316taro0915 wants to merge 1 commit into
taro0915 wants to merge 1 commit into
Conversation
Author
|
@microsoft-github-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Documentation-only follow-up to #2315. No behavior change.
qlib/contrib/strategy/signal_strategy.py— add a class docstring toTopkDropoutStrategystating that positions are equal-weighted, and noting the implication for benchmark choice. (The class previously had no docstring, only a# TODO:block.)qlib/workflow/record_temp.py— add a note to thePortAnaRecorddocstring describing howexcess_return_with_cost/excess_return_without_costare computed, and that no weighting adjustment is applied.docs/component/strategy.rst— add the same note to theTopkDropoutStrategysection.No code paths, defaults, or outputs are modified.
Motivation and Context
Related issue: #2315
TopkDropoutStrategysizes new positions by splitting the available cash evenly across the stocks to be bought (qlib/contrib/strategy/signal_strategy.py:266), so the realized portfolio is close to equal-weighted.PortAnaRecordreports excess return as a plain arithmetic difference against a single benchmark instrument (qlib/workflow/record_temp.py:507-512), and the default benchmark isSH000300(CSI 300), which is capitalization-weighted.These two defaults are used together in the default
PortAnaRecordconfig and throughoutexamples/benchmarks. Because no adjustment is made for the difference in weighting scheme, the reported excess return contains the equal- versus cap-weighting spread of the universe in addition to the contribution of the signal. #2315 has the measurements: with a zero-alpha signal the offset is material and consistently signed, and it shifts the reported numbers for a real LightGBM + Alpha158 run as well.This is not a defect in the arithmetic. Excess return against a named index is a legitimate quantity, and it is the right one if the question is "did this beat the CSI 300." It is a gap in what the documentation lets a reader assume, because the same number is routinely read as the contribution of the model. This PR makes the distinction explicit at the three places a user is most likely to be standing when they form that assumption.
Why documentation first
#2315 sketched two possible directions: changing or parameterizing the comparison, or documenting the current behavior. The second is separable and carries no compatibility risk, so it is offered on its own here rather than bundled. If maintainers prefer the first, an equal-weighted benchmark option is a natural follow-up —
qlib/contrib/report/analysis_position/profit_attribution.py:238already carries a TODO for exactly that — and I am happy to open it.How Has This Been Tested?
pytest qlib/tests/test_all_pipeline.pyunder upper directory ofqlib.Docstrings and reStructuredText only; no executable code paths are touched, so there are no test coverage implications. The change adds lines only (+40 / -0) and does not modify any existing line, so
blackformatting of existing code is unaffected.Types of changes