feat: varying-slopes effect-term design API + plain-factor parity (#58)#67
Merged
Conversation
Add an Effect term (levels, intercept, slope covariates) that lowers to the categories-backed Design; intercept-only effects reproduce the categories path, slope-bearing ones are rejected (SlopesNotYetSupported) until a later slice. Generalize solve/solve_batch over a new IntoDesign trait covering category arrays, Vec<Effect>, and Design.
Intercept-only effects and the equivalent categories matrix run through the same locality sort, so the result is bit-identical, not just close. Both solves are asserted converged so the equality cannot pass vacuously.
solve and Solver accept either a categories array or a list of Effect terms, copied out of Python so the borrowed native Effect can be rebuilt off-GIL. Route every entry point's preconditioner through From<PrecondInput> so the resolution lives in one place.
Cross-backend bit-identity vs the categories path, plus the empty-effect, slope-length, and slope-rejection error surfaces.
24371cf to
c57fabd
Compare
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.
solve/Solvernow accept either a categories matrix or alist[Effect](onefactor's level codes + optional intercept + per-level slopes). Intercept-only
terms lower to the existing fixed-effects path, bit-identical to the categories
solve; slope-bearing terms are validated but rejected for now.
Effect(core + PyO3): eager validation — empty-effect, per-slope length naming the bad slope.Design::new(effects): lowers intercept-only terms; rejects slope-bearing, naming the term.solve/solve_batch+Solvergeneralized overIntoDesign(adds aVec<Effect>impl).Parity: Rust + Python tests assert
x/demeanedbit-identical to the categories solve; error tests cover the rejection cases.Base
feature/slopes(carries prerequisite #65).