예제 #1
0
def template_clustering(data_path, levels, **kwargs):
    print("Sample: '%s'." % os.path.basename(data_path))

    density_threshold = kwargs.get("density_threshold", 0.0)
    amount_threshold = kwargs.get("amount_threshold", 0)
    data = read_sample(data_path)

    bang_instance = bang(data,
                         levels,
                         density_threshold=density_threshold,
                         amount_threshold=amount_threshold)
    bang_instance.process()

    clusters = bang_instance.get_clusters()
    noise = bang_instance.get_noise()
    directory = bang_instance.get_directory()
    dendrogram = bang_instance.get_dendrogram()

    bang_visualizer.show_blocks(directory)
    bang_visualizer.show_dendrogram(dendrogram)
    bang_visualizer.show_clusters(data, clusters, noise)

    if len(data[0]) == 2:
        animator = bang_animator(directory, clusters)
        animator.animate()
예제 #2
0
def template_clustering(data_path, levels, **kwargs):
    print("Sample: '%s'." % os.path.basename(data_path))

    density_threshold = kwargs.get("density_threshold", 0.0)
    amount_threshold = kwargs.get("amount_threshold", 0)
    data = read_sample(data_path)

    bang_instance = bang(data, levels, density_threshold=density_threshold, amount_threshold=amount_threshold)
    bang_instance.process()

    clusters = bang_instance.get_clusters()
    noise = bang_instance.get_noise()
    directory = bang_instance.get_directory()
    dendrogram = bang_instance.get_dendrogram()

    bang_visualizer.show_blocks(directory)
    bang_visualizer.show_dendrogram(dendrogram)
    bang_visualizer.show_clusters(data, clusters, noise)

    if len(data[0]) == 2:
        animator = bang_animator(directory, clusters)
        animator.animate()