def Mappe(data, intervals):
    filter_func = Eccentricity()
    cover = CubicalCover(n_intervals=intervals, overlap_frac=0.3)
    clusterer = DBSCAN()
    n_jobs = 2
    pipe = make_mapper_pipeline(
        filter_func=filter_func,
        cover=cover,
        clusterer=clusterer,
        verbose=False,
        n_jobs=n_jobs,
    )
    g = pipe.fit_transform(data)
    A = g.get_edgelist()
    G = nx.Graph(A)
    return G
Beispiel #2
0
def test_eccentricity_values_with_infinity_norm_equals_max_row_values(X):
    eccentricity = Eccentricity(exponent=np.inf)
    Xt = eccentricity.fit_transform(X)
    distance_matrix = squareform(pdist(X))
    assert_almost_equal(Xt, np.max(distance_matrix, axis=1).reshape(-1, 1))
Beispiel #3
0
def test_eccentricity_shape_equals_number_of_samples(X, exponent):
    """Verify that eccentricity preserves the nb of samples in the input."""
    eccentricity = Eccentricity(exponent=exponent)
    Xt = eccentricity.fit_transform(X)
    assert Xt.shape == (len(X), 1)