`LC2ST_NF` does not honor the `LC2ST` method contract
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 865
- Forks
- 260
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 5
Description
LC2ST_NF subclasses LC2ST, but its evaluation methods have a different contract. In LC2ST, theta_o are posterior samples at x_o. In LC2ST_NF, evaluation runs in the flow's base space on samples drawn once in __init__. The class docstring says so: no theta_o is passed to the evaluation functions.
The five overrides (get_scores, get_statistic_on_observed_data, p_value, reject_test, get_statistics_under_null_hypothesis) therefore drop theta_o. Pyright flags them under reportIncompatibleMethodOverride, see #1979.
A signature patch does not fix this. #1984 tried it: theta_o becomes an ignored parameter, x_o needs a None default plus a guard, and positional x_o calls break. We dropped that part of the PR.
The fix is structural. I see two options:
- Composition:
LC2ST_NFholds anLC2STand exposes its own(x_o, ...)API. - A shared private base for the training and null machinery.
LC2STandLC2ST_NFeach define their own public evaluation methods on top.
Both change the public hierarchy, isinstance(lc2st_nf, LC2ST) stops being true, so this needs a deprecation note.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the LC2ST and LC2ST_NF evaluation methods: get_scores, get_statistic_on_observed_data, p_value, reject_test, and get_statistics_under_null_hypothesis. Compare their contracts and the Pyright error from #1979, then choose a hierarchy or composition design that preserves each public API. Done means the overrides are compatible, positional x_o calls remain valid, and the isinstance change has a deprecation note.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100