Make the truth table a reusable analytical object - #17
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Keeps rows that thresholds excluded, records why, and lets a stored table be re-minimised without the original data.
Both minimisations agree with the estimator exactly; tests assert it. Only case-level fit still needs the original data, since it describes cases rather than configurations.
The distinction worth having
An outcome code conflates situations that call for different responses, so every row now carries
exclusion_reasonin words:A row can clear consistency and still be excluded by PRI — the existing coding sends it to
"C", which reads as "contradictory" and hides the real cause. Rather than change the coding and break parity, both failures are now named separately, and there is a test constructing exactly that case: consistency passes, PRI does not, and the reason mentions PRI and not consistency.excluded_rows()returns only rows a threshold held back — the ones a different analytical choice would have admitted. A row with genuinely low consistency is excluded by the data and is deliberately not listed, since no threshold would rescue it. That makes it the right input to a robustness discussion.exclusion_reasondefaults toNone, so existing construction is unaffected.to_framegains anexcluded_becausecolumn.498 tests at 100% coverage; mypy strict and docs build clean.
Summary by cubic
Makes the truth table a reusable analytical object: keeps threshold-excluded rows with clear reasons, adds JSON serialization, and allows direct minimization from stored tables. Improves transparency and lets you reproduce solutions without the original data.
New Features
exclusion_reason(frequency vs consistency vs PRI) and exposeexcluded_rows()for threshold-held rows only.positive_rows(),negative_rows(),contradictions(),remainders().TruthTableRow.excluded_by_thresholdflag.to_frame()gainsexcluded_because;summary()provides a quick count by group.to_dict(),from_dict(),to_json(),from_json().TruthTable.minimize(include_remainders, max_solutions)returns Boolean covers and matchesFSQCAconservative/parsimonious results; case-level fit still requires data.Docs & Tests
Written for commit 6a946f5. Summary will update on new commits.