Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 01eee85

Browse files
Return first element of numpy.random.choice()
1 parent b760c3e commit 01eee85

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎pygad/helper/unique.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def unique_genes_by_space(self,
282282
283283
Args:
284284
new_solution (list): A solution containing genes with duplicate values.
285-
gene_type (type): The data type of the gene (e.g., int, float).
285+
gene_type (type): The data type of the all the genes (e.g., int, float).
286286
not_unique_indices (list): The indices of genes with duplicate values.
287287
num_trials (int): The maximum number of attempts to resolve duplicates for each gene. Only works for floating-point numbers.
288288
@@ -417,7 +417,7 @@ def unique_gene_by_space(self,
417417
value_from_space = numpy.random.choice(numpy.arange(start=curr_gene_space['low'],
418418
stop=curr_gene_space['high'],
419419
step=curr_gene_space['step']),
420-
size=1)
420+
size=1)[0]
421421
else:
422422
value_from_space = numpy.random.uniform(low=curr_gene_space['low'],
423423
high=curr_gene_space['high'],
@@ -479,7 +479,7 @@ def unique_gene_by_space(self,
479479
value_from_space = numpy.random.choice(numpy.arange(start=self.gene_space['low'],
480480
stop=self.gene_space['high'],
481481
step=self.gene_space['step']),
482-
size=1)
482+
size=1)[0]
483483
else:
484484
value_from_space = numpy.random.uniform(low=self.gene_space['low'],
485485
high=self.gene_space['high'],

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /