def gathgeva_test(clusters, noise=10):
    q = 100 * clusters
    xs = datagen_2d.generate_2d_gathgeva_dataset(clusters, noise=noise, q=q)
    scatter_2d_data(xs)

    clusters = [GathGeva.GGCluster(1000, 2) for k in range(clusters)]
    fc = FuzzyClustring.FuzzyClassifier(xs, clusters, m=2)
    fc.fit(delta=.001,
           increase_iteration=20,
           increase_factor=1.2,
           plot_level=2,
           verbose_level=0,
           verbose_iteration=100)
    print fc.C
    fc.scatter_clusters_data()
def linear_test(clusters, noise=10):
    q = 50 * clusters
    xs = datagen_2d.generate_2d_line_dataset(clusters, noise=noise, q=q)
    scatter_2d_data(xs)

    clusters = [Linear.LinearCluster(1000, 2) for k in range(clusters)]
    fc = FuzzyClustring.FuzzyClassifier(xs, clusters, m=2)
    fc.fit(delta=.0001,
           increase_iteration=30,
           increase_factor=1.1,
           plot_level=2,
           verbose_level=0,
           verbose_iteration=100)
    print fc.C
    fc.scatter_clusters_data()
Exemplo n.º 3
0
def cmean_test(clusters, noise=10, data=None):
    if data is None:
        q = 100 * clusters
        xs = datagen_2d.generate_2d_cmeans_dataset(clusters, noise=noise, q=q)
        scatter_2d_data(xs)
    else:
        xs = data

    clusters = [CMean.CMeanCluster(1000, 2) for k in range(clusters)]
    fc = FuzzyClustring.FuzzyClassifier(xs, clusters, m=2)
    fc.fit(delta=.001,
           increase_iteration=20,
           increase_factor=1.2,
           plot_level=2,
           verbose_level=0,
           verbose_iteration=100)
    print fc.C
    fc.scatter_clusters_data()
def elliptical_test(clusters, ellipce_type=2, noise=10):
    q = 50 * clusters
    xs = datagen_2d.generate_2d_ellipse_dataset(clusters, noise=noise, q=q)
    scatter_2d_data(xs)

    if ellipce_type == 1:
        clusters = [
            Elliptical.EllipticalCluster(1000, 2) for k in range(clusters)
        ]
    elif ellipce_type == 2:
        clusters = [
            Elliptical.EllipticalCluster2(1000, 2) for k in range(clusters)
        ]

    fc = FuzzyClustring.FuzzyClassifier(xs, clusters, m=2)
    fc.fit(delta=.001,
           increase_iteration=30,
           increase_factor=1.2,
           plot_level=2,
           verbose_level=0,
           verbose_iteration=100)
    print fc.C
    fc.scatter_clusters_data()