Exemple #1
0
    def testNoFailureVisualizationApi(self):
        sample, observer = self.templateTestObserverCollecting(
            2, 10, True, True, True, random_state=1000)

        ga_visualizer.show_evolution(observer)
        ga_visualizer.show_clusters(sample, observer)
        ga_visualizer.animate_cluster_allocation(sample, observer)
Exemple #2
0
def template_clustering(path,
                        count_clusters,
                        chromosome_count,
                        population_count,
                        count_mutation_gens,
                        coeff_mutation_count=0.25,
                        select_coeff=1.0,
                        fps=15,
                        animation=False):

    sample = read_sample(path);

    algo_instance = genetic_algorithm(data=sample,
                                      count_clusters=count_clusters,
                                      chromosome_count=chromosome_count,
                                      population_count=population_count,
                                      count_mutation_gens=count_mutation_gens,
                                      coeff_mutation_count=coeff_mutation_count,
                                      select_coeff=select_coeff,
                                      observer=ga_observer(True, True, True))

    start_time = time.time();

    algo_instance.process();

    print("Sample: ", path, "\t\tExecution time: ", time.time() - start_time, "\n");

    observer = algo_instance.get_observer();
    
    ga_visualizer.show_clusters(sample, observer);
    
    if (animation is True):
        ga_visualizer.animate_cluster_allocation(sample, observer, movie_fps=fps, save_movie="clustering_animation.mp4");
Exemple #3
0
def template_clustering(path,
                        count_clusters,
                        chromosome_count,
                        population_count,
                        count_mutation_gens,
                        coeff_mutation_count=0.25,
                        select_coeff=1.0,
                        fps=15,
                        animation=False):

    sample = read_sample(path)

    algo_instance = genetic_algorithm(data=sample,
                                      count_clusters=count_clusters,
                                      chromosome_count=chromosome_count,
                                      population_count=population_count,
                                      count_mutation_gens=count_mutation_gens,
                                      coeff_mutation_count=coeff_mutation_count,
                                      select_coeff=select_coeff,
                                      observer=ga_observer(True, True, True))

    start_time = time.time()

    algo_instance.process()

    print("Sample: ", path, "\t\tExecution time: ", time.time() - start_time, "\n")

    observer = algo_instance.get_observer()
    
    ga_visualizer.show_clusters(sample, observer)
    
    if (animation is True):
        ga_visualizer.animate_cluster_allocation(sample, observer, movie_fps=fps, save_movie="clustering_animation.mp4")
Exemple #4
0
 def testNoFailureVisualizationApi(self):
     sample, observer = self.templateTestObserverCollecting(2, 10, True, True, True)
     
     ga_visualizer.show_evolution(observer)
     ga_visualizer.show_clusters(sample, observer)
     ga_visualizer.animate_cluster_allocation(sample, observer)