def johnson_lindenstrauss_min_dim(n_samples: int, eps: float=0.1):
    """Find a 'safe' number of components to randomly project to.

    Ref eqn 2.1 https://cseweb.ucsd.edu/~dasgupta/papers/jl.pdf

    Args:
        n_samples (int): Number of samples used to compute safe components
        eps (float, optional): Minimum distortion rate. Defaults to 0.1.
    """

    denominator = (eps**2 / 2) - (eps**3 / 3)
    return (4 * np.log(n_samples) / denominator).astype(np.int64)
Find a 'safe' number of components to randomly project to.

    Ref eqn 2.1 https://cseweb.ucsd.edu/~dasgupta/papers/jl.pdf

    Args:
        n_samples (int): Number of samples used to compute safe components
        eps (float, optional): Minimum distortion rate. Defaults to 0.1.
    
contrib/QualityInspector/qinspector/uad/utils/random_projection.py