Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ga.py #474

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pyclustering/cluster/ga.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ class genetic_algorithm:
"""

def __init__(self, data, count_clusters, chromosome_count, population_count, count_mutation_gens=2,
coeff_mutation_count=0.25, select_coeff=1.0, observer=ga_observer()):
coeff_mutation_count=0.25, select_coeff=1.0, crossover_rate=1.0, observer=ga_observer()):
"""!
@brief Initialize genetic clustering algorithm for cluster analysis.

Expand Down Expand Up @@ -383,7 +383,7 @@ def __init__(self, data, count_clusters, chromosome_count, population_count, cou
self._count_mutation_gens = count_mutation_gens

# Crossover rate
self._crossover_rate = 1.0
self._crossover_rate = crossover_rate

# Count of chromosome for mutation (range [0, 1])
self._coeff_mutation_count = coeff_mutation_count
Expand Down Expand Up @@ -591,7 +591,7 @@ def _get_crossover_mask(mask_length):
mask = np.zeros(mask_length)

# Set a half of array to 1
mask[:int(int(mask_length) / 6)] = 1
mask[:int(int(mask_length) / 2)] = 1

# Random shuffle
np.random.shuffle(mask)
Expand Down