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 $\epsilon$-embedding is given by $K \ge \frac{4 \cdot \ln(N)}{\frac{{\epsilon}^{2}}{2} - \frac{{\epsilon}^{3}}{3}}$.

The implementation is adapted from sklearn’s.