`LC2ST_NF` does not honor the `LC2ST` method contract

Aperta
#2,005 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

@pawank925 ci sta già lavorando.

Dal 3/9/2026.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Da chiarire
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Inizia leggendo i metodi di valutazione di LC2ST e LC2ST_NF: get_scores, get_statistic_on_observed_data, p_value, reject_test e get_statistics_under_null_hypothesis. Confronta i loro contratti e l’errore di Pyright di #1979, quindi scegli un design basato su gerarchia o composizione che preservi ogni API pubblica. Il lavoro è completato quando gli override sono compatibili, le chiamate posizionali a x_o rimangono valide e la modifica di isinstance include una nota di deprecazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

API changes architecture blocked diagnostics

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_NF holds an LC2ST and exposes its own (x_o, ...) API.
  • A shared private base for the training and null machinery. LC2ST and LC2ST_NF each 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.

Lingua principale
Python
Stelle
894
Fork
306
Merge medio
5g 21h
PR unite (30g)
61

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sbi-dev/sbi

Tutte le issue di sbi-dev/sbi

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.