numcodecs_random_projection

Function johnson_lindenstrauss_min_k

Source
pub fn johnson_lindenstrauss_min_k(
    n_samples: usize,
    OpenClosedUnit: OpenClosedUnit<f64>,
) -> usize
Expand description

Find a ‘safe’ number of components K to randomly project to.

The minimum number of components to guarantee the eps-embedding is given by K >= 4 log(N) / (eps^2 / 2 - eps^3 / 3).

The implementation is adapted from sklearn’s.