fn estimate_cardinalities(
    train: &SvmScanner,
    tsv_dense: Option<Vec<usize>>,
    freq_cutoff: usize,
) -> (usize, usize, Featurizer) {
    let (nlines, words, unique_words) = train.fold_reduce(
        || {
            (
                0,
                0,
                FeaturizerConstructor::new(freq_cutoff, tsv_dense.clone()),
            )
        },
        |(nlines, mut words, mut unique_words), word_iter| {
            words += unique_words.read_words(word_iter);
            (nlines + 1, words, unique_words)
        },
        |(l_nlines, l_words, mut l_unique_words), (r_nlines, r_words, mut r_unique_words)| {
            l_unique_words.merge(&mut r_unique_words);
            (l_nlines + r_nlines, l_words + r_words, l_unique_words)
        },
    );
    (nlines, words, unique_words.build())
}
/// Count total number of lines and words referred to by data, as well as
/// number of unique words, up to the specified relative error.
Count total number of lines and words referred to by data, as well as
number of unique words, up to the specified relative error.
Count total number of lines and words referred to by data as well as number of unique words up to the specified relative error .
fn estimate_cardinalities(
    train: &SvmScanner,
    tsv_dense: Option<Vec<usize>>,
    freq_cutoff: usize,
) -> (usize, usize, Featurizer) {
    let (nlines, words, unique_words) = train.fold_reduce(
        || {
            (
                0,
                0,
                FeaturizerConstructor::new(freq_cutoff, tsv_dense.clone()),
            )
        },
        |(nlines, mut words, mut unique_words), word_iter| {
            words += unique_words.read_words(word_iter);
            (nlines + 1, words, unique_words)
        },
        |(l_nlines, l_words, mut l_unique_words), (r_nlines, r_words, mut r_unique_words)| {
            l_unique_words.merge(&mut r_unique_words);
            (l_nlines + r_nlines, l_words + r_words, l_unique_words)
        },
    );
    (nlines, words, unique_words.build())
}
fn estimate_cardinalities ( train : & SvmScanner , tsv_dense : Option < Vec < usize > > , freq_cutoff : usize , ) -> ( usize , usize , Featurizer ) { let ( nlines , words , unique_words ) = train . fold_reduce ( | | { ( 0 , 0 , FeaturizerConstructor :: new ( freq_cutoff , tsv_dense . clone ( ) ) , ) } , | ( nlines , mut words , mut unique_words ) , word_iter | { words += unique_words . read_words ( word_iter ) ; ( nlines + 1 , words , unique_words ) } , | ( l_nlines , l_words , mut l_unique_words ) , ( r_nlines , r_words , mut r_unique_words ) | { l_unique_words . merge ( & mut r_unique_words ) ; ( l_nlines + r_nlines , l_words + r_words , l_unique_words ) } , ) ; ( nlines , words , unique_words . build ( ) ) }
Count total number of lines and words referred to by data, as well as
number of unique words, up to the specified relative error.
Count total number of lines and words referred to by data as well as number of unique words up to the specified relative error .
train
&SvmScanner
tsv_dense
Option<Vec<usize>>
freq_cutoff
usize
train
&SvmScanner
tsv_dense
Option<Vec<usize>>
freq_cutoff
usize