From 06ed09dccf51374f8f6a2d9ee3c5a412c06b8e4d Mon Sep 17 00:00:00 2001 From: augustodamasceno Date: 2023年1月22日 15:20:04 -0300 Subject: [PATCH] Fix Documentation User-Defined Mutation Operator Example: the number of genes is the offspring shape dimension index 1. --- docs/source/README_pygad_ReadTheDocs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/README_pygad_ReadTheDocs.rst b/docs/source/README_pygad_ReadTheDocs.rst index 71a4f7d1..423bd65d 100644 --- a/docs/source/README_pygad_ReadTheDocs.rst +++ b/docs/source/README_pygad_ReadTheDocs.rst @@ -2261,7 +2261,7 @@ gene's value. def mutation_func(offspring, ga_instance): for chromosome_idx in range(offspring.shape[0]): - random_gene_idx = numpy.random.choice(range(offspring.shape[0])) + random_gene_idx = numpy.random.choice(range(offspring.shape[1])) offspring[chromosome_idx, random_gene_idx] += numpy.random.random()

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