Skip to content

Commit fb67d8d

Browse files
committed
Fix typos
1 parent 3bcc0dd commit fb67d8d

File tree

4 files changed

+40
-22
lines changed

4 files changed

+40
-22
lines changed

docs/source/pygad.rst

+11-14
Original file line numberDiff line numberDiff line change
@@ -920,9 +920,7 @@ It accepts the following parameters:
920920
- ``pop_fitness=None``: An optional parameter that accepts a list of
921921
the fitness values of the solutions in the population. If ``None``,
922922
then the ``cal_pop_fitness()`` method is called to calculate the
923-
fitness values of the ``self.population``. Use
924-
``ga_instance.last_generation_fitness`` to use latest fitness value
925-
and skip recalculation of the population fitness.
923+
fitness values of the population.
926924

927925
It returns the following:
928926

@@ -1039,11 +1037,10 @@ Let's discuss how to do each of these steps.
10391037
Preparing the ``fitness_func`` Parameter
10401038
-----------------------------------------
10411039

1042-
Even there are some steps in the genetic algorithm pipeline that can
1043-
work the same regardless of the problem being solved, one critical step
1044-
is the calculation of the fitness value. There is no unique way of
1045-
calculating the fitness value and it changes from one problem to
1046-
another.
1040+
Even though some steps in the genetic algorithm pipeline can work the
1041+
same regardless of the problem being solved, one critical step is the
1042+
calculation of the fitness value. There is no unique way of calculating
1043+
the fitness value and it changes from one problem to another.
10471044

10481045
PyGAD has a parameter called ``fitness_func`` that allows the user to
10491046
specify a custom function/method to use when calculating the fitness.
@@ -1060,15 +1057,15 @@ optimization problem is single-objective or multi-objective.
10601057
``pygad.GA`` class.
10611058

10621059
- If the fitness function returns a ``list``, ``tuple``, or
1063-
``numpy.ndarray``, then the problem is single-objective. Even if
1064-
there is only one element, the problem is still considered
1065-
multi-objective. Each element represents the fitness value of its
1066-
corresponding objective.
1060+
``numpy.ndarray``, then the problem is multi-objective. Even if there
1061+
is only one element, the problem is still considered multi-objective.
1062+
Each element represents the fitness value of its corresponding
1063+
objective.
10671064

10681065
Using a user-defined fitness function allows the user to freely use
10691066
PyGAD to solve any problem by passing the appropriate fitness
1070-
function/method. It is very important to understand the problem well for
1071-
creating it.
1067+
function/method. It is very important to understand the problem well
1068+
before creating it.
10721069

10731070
Let's discuss an example:
10741071

docs/source/pygad_more.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,8 @@ After running the code again, it will find the same result.
595595
[ 2.77249188 -4.06570662 0.04196872 -3.47770796 -0.57502138 -3.22775267]
596596
0.04872203136549972
597597
598-
Continue without Loosing Progress
599-
=================================
598+
Continue without Losing Progress
599+
================================
600600

601601
In `PyGAD
602602
2.18.0 <https://pygad.readthedocs.io/en/latest/releases.html#pygad-2-18-0>`__,
@@ -615,7 +615,7 @@ call to the ``run()`` method.
615615
4. ``self.solutions_fitness``
616616

617617
This helps the user to continue where the last run stopped without
618-
loosing the values of these 4 attributes.
618+
losing the values of these 4 attributes.
619619

620620
Now, the user can save the model by calling the ``save()`` method.
621621

docs/source/releases.rst

+23-2
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,8 @@ Release Date: 9 September 2022
10201020
generation. Another advantage happens when the instance is loaded and
10211021
the ``run()`` method is called, as the old fitness value are shown on
10221022
the graph alongside with the new fitness values. Read more in this
1023-
section: `Continue without Loosing
1024-
Progress <https://pygad.readthedocs.io/en/latest/pygad_more.html#continue-without-loosing-progress>`__
1023+
section: `Continue without Losing
1024+
Progress <https://pygad.readthedocs.io/en/latest/pygad_more.html#continue-without-losing-progress>`__
10251025

10261026
4. Thanks `Prof. Fernando Jiménez
10271027
Barrionuevo <http://webs.um.es/fernan>`__ (Dept. of Information and
@@ -1464,6 +1464,27 @@ Release Date 7 September 2023
14641464
class is removed. Instead, please use the ``plot_fitness()`` if you
14651465
did not upgrade yet.
14661466

1467+
.. _pygad-321:
1468+
1469+
PyGAD 3.2.1
1470+
-----------
1471+
1472+
Release Date ... 2023
1473+
1474+
1. Fix a bug when multi-objective optimization is used with batch
1475+
fitness calculation (e.g. ``fitness_batch_size`` set to a non-zero
1476+
number).
1477+
1478+
2. Fix a bug in the ``pygad.py`` script when finding the index of the
1479+
best solution. It does not work properly with multi-objective
1480+
optimization where ``self.best_solutions_fitness`` have multiple
1481+
columns.
1482+
1483+
.. code:: python
1484+
1485+
self.best_solution_generation = numpy.where(numpy.array(
1486+
self.best_solutions_fitness) == numpy.max(numpy.array(self.best_solutions_fitness)))[0][0]
1487+
14671488
PyGAD Projects at GitHub
14681489
========================
14691490

pygad/pygad.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ def __init__(self,
726726
if self.mutation_probability is None:
727727
if not self.suppress_warnings:
728728
warnings.warn(
729-
f"The percentage of genes to mutate (mutation_percent_genes={mutation_percent_genes}) resutled in selecting ({mutation_num_genes}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
729+
f"The percentage of genes to mutate (mutation_percent_genes={mutation_percent_genes}) resulted in selecting ({mutation_num_genes}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
730730
mutation_num_genes = 1
731731

732732
elif type(mutation_percent_genes) in GA.supported_int_float_types:
@@ -745,7 +745,7 @@ def __init__(self,
745745
if mutation_num_genes == 0:
746746
if self.mutation_probability is None:
747747
if not self.suppress_warnings:
748-
warnings.warn(f"The percentage of genes to mutate (mutation_percent_genes={mutation_percent_genes}) resutled in selecting ({mutation_num_genes}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
748+
warnings.warn(f"The percentage of genes to mutate (mutation_percent_genes={mutation_percent_genes}) resulted in selecting ({mutation_num_genes}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
749749
mutation_num_genes = 1
750750
else:
751751
self.valid_parameters = False
@@ -771,7 +771,7 @@ def __init__(self,
771771
# Based on the mutation percentage of genes, if the number of selected genes for mutation is less than the least possible value which is 1, then the number will be set to 1.
772772
if mutation_num_genes[idx] == 0:
773773
if not self.suppress_warnings:
774-
warnings.warn(f"The percentage of genes to mutate ({mutation_percent_genes[idx]}) resutled in selecting ({mutation_num_genes[idx]}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
774+
warnings.warn(f"The percentage of genes to mutate ({mutation_percent_genes[idx]}) resulted in selecting ({mutation_num_genes[idx]}) genes. The number of genes to mutate is set to 1 (mutation_num_genes=1).\nIf you do not want to mutate any gene, please set mutation_type=None.")
775775
mutation_num_genes[idx] = 1
776776
if mutation_percent_genes[0] < mutation_percent_genes[1]:
777777
if not self.suppress_warnings:

0 commit comments

Comments
 (0)