Type public results as TypedDicts; bump to 1.1.0 - #78
Merged
Conversation
Replace the dict[str, Any] result aliases with real TypedDicts so mypy checks result access for users and internal consumers alike: - regression: RegResult (plus RegPoints, RegFitted, RegPredInt, DerivativeTable, RegEquation, RegXStar). nns_reg is overloaded on multivariate_call: the internal True contract returns bare RegPoints; the public form returns RegResult | MRegResult (2-D x dispatches to nns_m_reg, as in R). Conditional fields use NotRequired or documented None defaults; typing revealed and now records that Fitted.xy gains conf.int.* columns when confidence_interval is set. - multivariate_regression: MRegResult / MRegPredInt / MRegFitted (fit-table keys stay dynamic V1..Vn by design). - stack: StackResult; boost: BoostResult (features_only form via NotRequired); var: VarResult (h=0 form via NotRequired); meboot: MebootResult; seasonality: SeasonalityTable/SeasonalityResult replacing dict[str, object]. - Export the result types from nns.__init__ so callers can annotate. - Internal cleanups the checker forced: dim-red call sites in stack and boost narrow to RegResult explicitly; redundant casts dropped in core interval code and tests; nns_arma's percent-labelled pred-int dict keys are runtime-computed R names and stay dict[str, NDArray]. Results remain plain dicts at runtime; no behavior change. Full suite passes against the committed R cache without regeneration. Bump version to 1.1.0 (pyproject, __init__, README) per the batched release plan; refresh uv.lock.
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.
Replaces the
dict[str, Any]result aliases with real TypedDicts. Results stay plain dicts at runtime — no behavior change, verified against the committed R cache with no regeneration.What users get
RegResult,MRegResult,StackResult,BoostResult,VarResult,MebootResult,SeasonalityResult(plus the inner shapes:RegFitted,RegPoints,RegPredInt,DerivativeTable,RegEquation,RegXStar,MRegPredInt,SeasonalityTable) — exported fromnnsso pipelines can annotate."Fitted.xy","Point.est") and mypy-caught typos, in user code and inside the library:nns_stack/nns_boost's consumption ofnns_regresults is now actually type-checked.NotRequiredmarks thepoint_only/features_only/h=0partial forms; docstrings state whenequation,x.star,pred.int, andconf.int.*appear.Design decisions
nns_regis overloaded onmultivariate_call: the internalTruecontract returns bareRegPoints; the public form returnsRegResult | MRegResult(2-Dxdispatches tonns_m_reg, matching R).part.pyprecedent; class syntax elsewhere.nns_arma's percent-labelled pred-int keys ("Lower 2.5% pred.int") are runtime-computed R names, and m-reg fit tables key columnsV1..Vn— both remaindict[str, NDArray]with the format documented.Fitted.xygainsconf.int.*columns whenconfidence_intervalis set; boost'sfeature.frequencyis float64 (R numeric); meboot's degenerate inputs return partial dicts.Release setup
Bumps version to 1.1.0 in pyproject/
__init__/README (check_version_consistencypasses) per the batched-release plan for the next PyPI push.Verification
NNS_R_CACHE_ONLY=1(existing cache, no regeneration): 2202 passed; the 3test_practical_examplesfailures are the known stale-local-extension issue, green in CI.mypy --strictandruffclean; runtime smoke confirms results are unchanged plain dicts.Note: until #77 (numpy<2.5 pin) merges, this PR's CI rolls the numpy-2.5.1 runner lottery — a cache-miss failure on 3.12/3.13 would be that, not this change.