Skip to content

Functions to split a slice into random parts.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

carrascomj/rand_split

Repository files navigation

Crates.io Documentation Build

rand_split

This crate achieves the functionality of sklearn's train_test_split to generate splits of the data (in this case, a slice), generalized for an arbitrary number of splits. It both provides functions (see split_parts) that work on slices and iterator traits (see PartsSplit) to work with streams of data.

Check out the examples in the repository for more information.

Example

use rand_split::split_parts;
use std::convert::TryInto;

let mut data = [1, 2, 3, 4, 5, 6, 8, 9, 10];
let [train, test, valid]: [&mut [u8]; 3] = split_parts(&mut data, &[0.4, 0.2, 0.4])
    .try_into()
    .expect("Works, length (3) comes from arguments.");

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

README.md is automatically generated on CI using cargo-readme. Please, modify README.tpl or lib.rs instead (check the github worflow for more details).

About

Functions to split a slice into random parts.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages