Repository navigation
Conversation
The report copied constructor attributes: dtype as str(dtype) (a class
repr that changed after a spec round trip with an unchanged
fingerprint), output_format as the request ("auto" rather than the
fitted format), and random_state as given, so a NumPy seed made
json.dumps(report) fail.
It now reports the NumPy dtype name, the output format resolved at fit
(falling back to the request for older specs) and a NumPy seed as a
Python int.
Fixes #187
2 tasks
This branch has not been deployed
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.
Fixes #187.
Preprocessor.reproducibility_report()echoed raw constructor values:dtypeas a class repr that changed after a spec round trip, while the fingerprint stayed the same;output_formatas the unresolved'auto';random_stateas is, which madejson.dumps(report)fail.Root cause
reproducibility_report(pretab/preprocessor.py) reportedstr(self.dtype),self.output_formatandself.random_stateunchanged.Fix
dtype:str(np.dtype(self.dtype)), the NumPy dtype name ('float32','float64'), orNonewhen unset.output_format:getattr(self, "output_format_", self.output_format), the format resolved at fit. Specs written beforeoutput_format_existed keep the requested value, astransformalready does.random_state:.item()of a NumPy scalar seed, so the report holds a Python int.Everything else in the report, and
fingerprint_, is unchanged.Behaviour changes
report["dtype"]changes from e.g."<class 'numpy.float32'>"to'float32'.report["output_format"]is'dense'or'sparse'foroutput_format="auto". Explicit"dense"/"sparse"requests report the same value as before.report["random_state"]is a Python int for a NumPy seed.to_spec()/from_spec()round trip now leaves the report unchanged.Documentation
reproducibility_reportdocstring (Returns): JSON-serializable values, the dtype name and the resolved format.docs/core_concepts/reproducibility.md: the same, and that a spec round trip leaves the report unchanged.Tests
In
tests/integration/test_fingerprint.py:test_reproducibility_report_names_the_output_dtype(None,np.float32,float,"float32"): the dtype name, and the same report after a JSON spec round trip. Thenp.float32andfloatcases fail onmain;Noneand the string are guards that pass on both.test_reproducibility_report_gives_the_resolved_output_format: fails onmain, passes here.test_reproducibility_report_is_json_serializable_with_a_numpy_seed: fails onmain, passes here.test_reproducibility_report_contentsand the grouped replay tests that compare reports still pass.Reproduction
The script from #187 on this branch:
Checks
just test: 4682 passed, 59 skipped, 7 xfailed; coverage 95.71% (gate 90%).scripts/quickstart.pypasses.just docs: strict build succeeds.just check: all pre-commit and pre-push hooks pass (file hygiene, ruff format, ruff lint, prettier, pyright with 0 errors).Merge notes
main. Git merges this branch cleanly with every open per-issue branch (fix(binning): reject edges the soft encoding cannot use #150 to fix(splines): do not report explicit knot placement as target-aware #186).