

def test_random_projection_embedding_quality():
    (data, _) = make_sparse_random_data(8, 5000, 15000)
    eps = 0.2
    original_distances = euclidean_distances(data, squared=True)
    original_distances = original_distances.ravel()
    non_identical = (original_distances != 0.0)
    original_distances = original_distances[non_identical]
    for RandomProjection in all_RandomProjection:
        rp = RandomProjection(n_components='auto', eps=eps, random_state=0)
        projected = rp.fit_transform(data)
        projected_distances = euclidean_distances(rp, squared=True)
        projected_distances = projected_distances.ravel()
        projected_distances = projected_distances[non_identical]
        distances_ratio = (projected_distances / original_distances)
        assert_less(distances_ratio.max(), (1 + eps))
        assert_less((1 - eps), distances_ratio.min())

dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/tests/test_random_projection.py test_random_projection_embedding_quality/VarMisuse@99/150 `projected`->`rp`