Skip to main content

check_cover_sample_count

Function check_cover_sample_count 

Source
pub fn check_cover_sample_count(
    options: &CoverOptions,
    sample_count: usize,
) -> Result<()>
Available on crate feature dict-builder only.
Expand description

Refuse sample_count samples the COVER training options select cannot build from: too few once the split takes its scoring share, or none left to score on. Needs only the count, so a caller can ask before reading a sample.

§Errors

InvalidInput for tuning out of range, where TrainingError::of reports TrainingError::Parameter, and for too few samples, where it reports TrainingError::Samples.

§Examples

use structured_zstd::dictionary::{CoverOptions, check_cover_sample_count};

// The search builds from the leading three quarters of the samples.
let search = CoverOptions { split_point: 0.75, ..CoverOptions::default() };
assert!(check_cover_sample_count(&search, 6).is_err());
assert!(check_cover_sample_count(&search, 8).is_ok());