Genetic algorithm visualizer is used to show clustering results that are specific for this particular algorithm: clusters, evolution of global and local optimum.
More...
|
def | show_evolution (observer, start_iteration=0, stop_iteration=None, ax=None, display=True) |
| Displays evolution of fitness function for the best chromosome, for the current best chromosome and average value among all chromosomes. More...
|
|
def | show_clusters (data, observer, marker='.', markersize=None) |
| Shows allocated clusters by the genetic algorithm. More...
|
|
def | animate_cluster_allocation (data, observer, animation_velocity=75, movie_fps=5, save_movie=None) |
| Animate clustering process of genetic clustering algorithm. More...
|
|
Genetic algorithm visualizer is used to show clustering results that are specific for this particular algorithm: clusters, evolution of global and local optimum.
The visualizer requires 'ga_observer' that collects evolution of clustering process in genetic algorithm. The observer is created by user and passed to genetic algorithm. There is usage example of the visualizer using the observer:
from pyclustering.samples.definitions import SIMPLE_SAMPLES
observer_instance = ga_observer(True, True, True)
ga_instance = genetic_algorithm(data=sample,
count_clusters=2,
chromosome_count=20,
population_count=20,
count_mutation_gens=1,
observer=observer_instance)
ga_instance.process()
clusters = ga_instance.get_clusters()
print("Amount of clusters: '%d'. Clusters: '%s'" % (len(clusters), clusters))
ga_visualizer.show_clusters(sample, observer_instance)
- See also
- cluster_visualizer
Definition at line 160 of file ga.py.