Repository navigation
fix(datasets): decouple datasets feature from std_rand - #499
Open
ShryukGrandhi wants to merge 1 commit into
Open
ShryukGrandhi wants to merge 1 commit into
ShryukGrandhi wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #499 +/- ##
===========================================
+ Coverage 43.97% 85.58% +41.60%
===========================================
Files 85 96 +11
Lines 7281 9373 +2092
===========================================
+ Hits 3202 8022 +4820
+ Misses 4079 1351 -2728 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 #416
Checklist
Current behaviour
The
datasetsfeature enablesstd_rand. The embedded toy datasets (iris, boston, digits, ...) do not use an RNG. But the generators indataset/generator.rs(make_blobs,make_circles,make_moons) callrand::rng(), which exists only withrand/thread_rng. If you removestd_randfromdatasets,cargo build --no-default-features --features datasetsfails withcannot find function rng in crate rand. The test helperreaders/io_testing.rsalso callsrand::rng()to make temporary file names, socargo test --features datasetscannot compile withoutstd_rand.New expected behaviour
Cargo.toml:datasets = ["serde"].rand_custom::get_rng_impl(None), like the other modules in the crate. Withstd_rand, the RNG takes its seed from OS entropy, so the output stays random as before. Withoutstd_rand, the RNG isSmallRngwith a fixed seed (orgetrandomwithjs), so the output is the same for each call.TemporaryTextFile(test-only) makes its file name from the process id and an atomic counter. It does not need an OS RNG.test_generators_without_std_rand_are_reproducible. It runs only whenstd_randandjsare off, and it checks that the generators compile and give reproducible output in that configuration.Change logs
Changed
datasetsfeature no longer enablesstd_rand. If you want non-deterministic generator output, enablestd_randtogether withdatasets. This is inCHANGELOG.md.Testing
cargo build --no-default-features --features datasets(failed before the fix, passes now)cargo test,cargo test --features datasets,cargo test --features datasets,std_rand,cargo test --all-features: all passcargo fmt --all -- --check,cargo clippy --all-features -- -Drust-2018-idioms -Dwarnings: clean