Skip to content

Commit

Permalink
Fix typos using codespell -i 3 -S '*.c,*.h' -w
Browse files Browse the repository at this point in the history
  • Loading branch information
rht committed Jan 18, 2022
1 parent 2f63dcf commit fc8eeae
Show file tree
Hide file tree
Showing 23 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DEAP includes the following features:

* Genetic algorithm using any imaginable representation
* List, Array, Set, Dictionary, Tree, Numpy Array, etc.
* Genetic programing using prefix trees
* Genetic programming using prefix trees
* Loosely typed, Strongly typed
* Automatically defined functions
* Evolution strategies (including CMA-ES)
Expand Down
10 changes: 5 additions & 5 deletions deap/benchmarks/movingpeaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ def function1(individual, position, height, width):
class MovingPeaks:
"""The Moving Peaks Benchmark is a fitness function changing over time. It
consists of a number of peaks, changing in height, width and location. The
peaks function is given by *pfunc*, wich is either a function object or a
peaks function is given by *pfunc*, which is either a function object or a
list of function objects (the default is :func:`function1`). The number of
peaks is determined by *npeaks* (which defaults to 5). This parameter can
be either a integer or a sequence. If it is set to an integer the number
of peaks won't change, while if set to a sequence of 3 elements, the
number of peaks will fluctuate between the first and third element of that
sequence, the second element is the inital number of peaks. When
sequence, the second element is the initial number of peaks. When
fluctuating the number of peaks, the parameter *number_severity* must be
included, it represents the number of peak fraction that is allowed to
change. The dimensionality of the search domain is *dim*. A basis function
Expand Down Expand Up @@ -100,7 +100,7 @@ class MovingPeaks:
``period`` 5000 5000 1000 Period between two changes.
=================== ============================= =================== =================== ======================================================================================================================
Dictionnaries :data:`SCENARIO_1`, :data:`SCENARIO_2` and
Dictionaries :data:`SCENARIO_1`, :data:`SCENARIO_2` and
:data:`SCENARIO_3` of this module define the defaults for these
parameters. The scenario 3 requires a constant basis function
which can be given as a lambda function ``lambda x: constant``.
Expand Down Expand Up @@ -211,7 +211,7 @@ def __call__(self, individual, count=True):
configuration.
:param indidivudal: The individual to evaluate.
:param count: Wether or not to count this evaluation in
:param count: Whether or not to count this evaluation in
the total evaluation count. (Defaults to
:data:`True`)
"""
Expand All @@ -237,7 +237,7 @@ def __call__(self, individual, count=True):
self._error = min(self._error, abs(fitness - self._optimum))
self._offline_error += self._error

# We exausted the number of evaluation, change peaks for the next one.
# We exhausted the number of evaluation, change peaks for the next one.
if self.period > 0 and self.nevals % self.period == 0:
self.changePeaks()

Expand Down
6 changes: 3 additions & 3 deletions deap/benchmarks/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class scale(object):
This decorator adds a :func:`scale` method to the decorated function.
"""
def __init__(self, factor):
# Factor is inverted since it is aplied to the individual and not the
# Factor is inverted since it is applied to the individual and not the
# objective function
self.factor = tuple(1.0/f for f in factor)

Expand All @@ -205,15 +205,15 @@ def evaluate(individual):
# This will cancel the scaling
evaluate.scale([1.0, 1.0, ..., 1.0])
"""
# Factor is inverted since it is aplied to the individual and not the
# Factor is inverted since it is applied to the individual and not the
# objective function
self.factor = tuple(1.0/f for f in factor)

class bound(object):
"""Decorator for crossover and mutation functions, it changes the
individuals after the modification is done to bring it back in the allowed
*bounds*. The *bounds* are functions taking individual and returning
wheter of not the variable is allowed. You can provide one or multiple such
whether of not the variable is allowed. You can provide one or multiple such
functions. In the former case, the function is used on all dimensions and
in the latter case, the number of functions must be greater or equal to
the number of dimension of the individuals.
Expand Down
4 changes: 2 additions & 2 deletions deap/cma.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class StrategyOnePlusLambda(object):
| ``d`` | ``1.0 + N / (2.0 * | Damping for step-size. |
| | lambda_)`` | |
+----------------+---------------------------+----------------------------+
| ``ptarg`` | ``1.0 / (5 + sqrt(lambda_)| Taget success rate. |
| ``ptarg`` | ``1.0 / (5 + sqrt(lambda_)| Target success rate. |
| | / 2.0)`` | |
+----------------+---------------------------+----------------------------+
| ``cp`` | ``ptarg * lambda_ / (2.0 +| Step size learning rate. |
Expand Down Expand Up @@ -346,7 +346,7 @@ class StrategyMultiObjective(object):
+================+===========================+============================+
| ``d`` | ``1.0 + N / 2.0`` | Damping for step-size. |
+----------------+---------------------------+----------------------------+
| ``ptarg`` | ``1.0 / (5 + 1.0 / 2.0)`` | Taget success rate. |
| ``ptarg`` | ``1.0 / (5 + 1.0 / 2.0)`` | Target success rate. |
+----------------+---------------------------+----------------------------+
| ``cp`` | ``ptarg / (2.0 + ptarg)`` | Step size learning rate. |
+----------------+---------------------------+----------------------------+
Expand Down
2 changes: 1 addition & 1 deletion deap/gp.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ def mutShrink(individual):
"""This operator shrinks the *individual* by choosing randomly a branch and
replacing it with one of the branch's arguments (also randomly chosen).
:param individual: The tree to be shrinked.
:param individual: The tree to be shrunk.
:returns: A tuple of one tree.
"""
# We don't want to "shrink" the root
Expand Down
4 changes: 2 additions & 2 deletions deap/tools/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ def __init__(self):

def record(self, **infos):
"""Enter a record of event in the logbook as a list of key-value pairs.
The informations are appended chronologically to a list as a dictionary.
When the value part of a pair is a dictionary, the informations contained
The information are appended chronologically to a list as a dictionary.
When the value part of a pair is a dictionary, the information contained
in the dictionary are recorded in a chapter entitled as the name of the
key part of the pair. Chapters are also Logbook.
"""
Expand Down
2 changes: 1 addition & 1 deletion doc/code/tutorials/part_4/4_4_Using_Cpp_NSGA.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def main():
del ind1.fitness.values
del ind2.fitness.values

# Note here that we have a different sheme of mutation than in the
# Note here that we have a different scheme of mutation than in the
# original algorithm, we use 3 different mutations subsequently.
for ind in offspring:
if random.random() < MUTPB:
Expand Down
2 changes: 1 addition & 1 deletion doc/code/tutorials/part_4/4_5_home_made_eval_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def main():
del ind1.fitness.values
del ind2.fitness.values
t3 = time.time()
# Note here that we have a different sheme of mutation than in the
# Note here that we have a different scheme of mutation than in the
# original algorithm, we use 3 different mutations subsequently.
for ind in offspring:
if random.random() < MUTPB:
Expand Down
4 changes: 2 additions & 2 deletions doc/examples/bipop_cmaes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ need a minimizing fitness and an individual that is a :class:`list`.

The main function includes the setting of some parameters, namely the number
of increasing population restarts and the initial sigma value. Then, the
instanciation of the :class:`~deap.base.Toolbox` is done in the main function
instantiation of the :class:`~deap.base.Toolbox` is done in the main function
because it will change with the restarts. Next are initialized the
:class:`~deap.tools.HallOfFame`, The :class:`~deap.tools.statistics` and the list
of :class:`~deap.tools.Logbook` objects, one for each restart.
Expand All @@ -35,7 +35,7 @@ is simply the generate-update loop as presented in the
.. literalinclude:: /../examples/es/cma_bipop.py
:lines: 62,101-110,114-130,151-188,192-194

Some variables have been omited for clarity, refer to the complete example for
Some variables have been omitted for clarity, refer to the complete example for
more details :example:`es/cma_bipop`.

.. [Hansen2001] Hansen and Ostermeier, 2001. Completely Derandomized
Expand Down
2 changes: 1 addition & 1 deletion doc/examples/ga_onemax_numpy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ short example. The individual class is inherited from the :class:`numpy.ndarray`
:lines: 18,26

The first major difference is the crossover function that implements
the copying mechanism mentionned in the :doc:`/tutorials/advanced/numpy` tutorial.
the copying mechanism mentioned in the :doc:`/tutorials/advanced/numpy` tutorial.

.. literalinclude:: /../examples/ga/onemax_numpy.py
:pyobject: cxTwoPointCopy
Expand Down
4 changes: 2 additions & 2 deletions doc/examples/pso_multiswarm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ In this example we show how to use the :class:`~deap.benchmarks.movingpeaks.Movi

Choosing the Scenario
---------------------
The moving peak benchmark allows to choose from the 3 original scenarios proposed in the `original studies <http://people.aifb.kit.edu/jbr/MovPeaks/>`_. This is done by retreiving one of the constants defined in the :mod:`~deap.benchmarks.movingpeaks` module. Here we will use Scenario 2.
The moving peak benchmark allows to choose from the 3 original scenarios proposed in the `original studies <http://people.aifb.kit.edu/jbr/MovPeaks/>`_. This is done by retrieving one of the constants defined in the :mod:`~deap.benchmarks.movingpeaks` module. Here we will use Scenario 2.

.. literalinclude:: /../examples/pso/multiswarm.py
:lines: 37,41
Expand All @@ -23,7 +23,7 @@ As in every DEAP example we are required to create the objects. The moving peak
.. literalinclude:: /../examples/pso/multiswarm.py
:lines: 48-51

Then, the particle generator is defined. It takes the particle class object :data:`pclass` into which to put the data. Remeber that :class:`creator.Particle`, which is gonna be give to this argument in the toolbox, inherits from :class:`list` and can be initialized with an iterable. The position (elements of the list) and the speed (attribute) of the particle is set to randomly generated numbers between the given bounds.
Then, the particle generator is defined. It takes the particle class object :data:`pclass` into which to put the data. Remember that :class:`creator.Particle`, which is gonna be give to this argument in the toolbox, inherits from :class:`list` and can be initialized with an iterable. The position (elements of the list) and the speed (attribute) of the particle is set to randomly generated numbers between the given bounds.

.. literalinclude:: /../examples/pso/multiswarm.py
:pyobject: generate
Expand Down
2 changes: 1 addition & 1 deletion doc/releases.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ API enhancements
- gp: Replaced :func:`~deap.gp.evaluate` and :func:`~deap.gp.lambdify` by a single function :func:`~deap.gp.compile`.
- gp: Replaced :func:`~deap.gp.lambdifyADF` by :func:`~deap.gp.compileADF`.
- gp: New :func:`~deap.gp.graph` function that returns a list of nodes, edges and a
labels dictionary that can then be feeded directly to networkx to
labels dictionary that can then be fed directly to networkx to
draw the tree.
- gp: Renamed :func:`deap.gp.genRamped` as :func:`deap.gp.genHalfAndHalf`.
- gp: Merged :func:`~deap.gp.staticDepthLimit` and :func:`~deap.gp.staticSizeLimit` in a
Expand Down
6 changes: 3 additions & 3 deletions doc/tutorials/advanced/numpy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ individual being changed.

The problem is that, first, the elements in ``a`` are replaced by the
elements of the view returned by ``b`` and the element of ``b`` are replaced
by the element in the view of ``a`` which are now the one intially in ``b``
by the element in the view of ``a`` which are now the one initially in ``b``
leading to the wrong final result. One way of to circumvent this problem is
to explicitely copy the view returned by the ``__getitem__``.
to explicitly copy the view returned by the ``__getitem__``.
::

>>> import numpy
Expand Down Expand Up @@ -110,7 +110,7 @@ Performance
-----------
If your intent is performance, `DEAP Speed
<http://deap.gel.ulaval.ca/speed/>`_ reveals that using an
:class:`array.array` should be prefered to :class:`numpy.ndarray`. This is
:class:`array.array` should be preferred to :class:`numpy.ndarray`. This is
mostly because the creation (also required by the deep copy) of new arrays is
longer for the :class:`numpy.array` than for :class:`array.array`.

Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/basic/part2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ case of the multiple individual case.

|more| For more information on decorators, see
`Introduction to Python Decorators <http://www.artima.com/weblogs/viewpost.jsp?thread=240808>`_
and `Python Decorator Libary <http://wiki.python.org/moin/PythonDecoratorLibrary>`_.
and `Python Decorator Library <http://wiki.python.org/moin/PythonDecoratorLibrary>`_.

Variations
----------
Expand Down
6 changes: 3 additions & 3 deletions doc/tutorials/basic/part4.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ that modifications made to an object on a distant processing unit will not be
made available to the other processing units (including the master one) if it
is not explicitly communicated through function arguments and return values.

Scalable Concurent Operations in Python (SCOOP)
Scalable Concurrent Operations in Python (SCOOP)
-----------------------------------------------
SCOOP_ is a distributed task module allowing concurrent parallel programming on
various environments, from heterogeneous grids to supercomputers. It has an
Expand All @@ -29,7 +29,7 @@ distribute the evaluations, we will replace this map by the one from SCOOP.

toolbox.register("map", futures.map)

Once this line is added, your program absolutly needs to be run from a
Once this line is added, your program absolutely needs to be run from a
:func:`main` function as mentioned in the
`scoop documentation <http://scoop.readthedocs.org/en/latest/usage.html>`_. To
run your program, use scoop as the main module.
Expand Down Expand Up @@ -95,7 +95,7 @@ toolbox.
.. Parallel Variation
.. ------------------
..
.. The paralellization of the variation operators is not directly supported in
.. The parallelization of the variation operators is not directly supported in
.. the algorithms, although it is still possible. What one needs is to create its
.. own algorithm (from one in the algorithm module for example) and change the
.. desired lines in order to use the :meth:`~deap.toolbox.map` method from the
Expand Down
2 changes: 1 addition & 1 deletion examples/bbob.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def main(func, dim, maxfuncevals, ftarget=None):
best.fitness.values = toolbox.evaluate(best)

# Evolve until ftarget is reached or the number of evaluation
# is exausted (maxfuncevals)
# is exhausted (maxfuncevals)
for g in range(1, maxfuncevals):
toolbox.update(worst, best, sigma)
worst.fitness.values = toolbox.evaluate(worst)
Expand Down
2 changes: 1 addition & 1 deletion examples/coev/coop_evol.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def main(extended=True, verbose=True):
# print final representatives without noise
print("".join(str(x) for x, y in zip(r, noise) if y == "*"))

if extended and plt: # Ploting of the evolution
if extended and plt: # Plotting of the evolution
line1, = plt.plot(collab, "--", color="k")

for con in contribs:
Expand Down
2 changes: 1 addition & 1 deletion examples/de/sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def main():
for g in range(1, NGEN):
children = []
for agent in pop:
# We must clone everything to ensure independance
# We must clone everything to ensure independence
a, b, c = [toolbox.clone(ind) for ind in toolbox.select(pop)]
x = toolbox.clone(agent)
y = toolbox.clone(agent)
Expand Down
4 changes: 2 additions & 2 deletions examples/es/cma_bipop.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"""Implementation of the BI-Population CMA-ES algorithm. As presented in
*Hansen, 2009, Benchmarking a BI-Population CMA-ES on the BBOB-2009 Function
Testbed* with the exception of the modifications to the original CMA-ES
parameters mentionned at the end of section 2's first paragraph.
parameters mentioned at the end of section 2's first paragraph.
"""

from collections import deque
Expand Down Expand Up @@ -174,7 +174,7 @@ def main(verbose=True):
if len(bestvalues) > STAGNATION_ITER and len(medianvalues) > STAGNATION_ITER and \
numpy.median(bestvalues[-20:]) >= numpy.median(bestvalues[-STAGNATION_ITER:-STAGNATION_ITER + 20]) and \
numpy.median(medianvalues[-20:]) >= numpy.median(medianvalues[-STAGNATION_ITER:-STAGNATION_ITER + 20]):
# Stagnation occured
# Stagnation occurred
conditions["Stagnation"] = True

if strategy.cond > 10**14:
Expand Down
2 changes: 1 addition & 1 deletion examples/ga/evosn.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def main():
del ind1.fitness.values
del ind2.fitness.values

# Note here that we have a different sheme of mutation than in the
# Note here that we have a different scheme of mutation than in the
# original algorithm, we use 3 different mutations subsequently.
for ind in offspring:
if random.random() < MUTPB:
Expand Down
2 changes: 1 addition & 1 deletion examples/ga/mo_rhv.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def main(seed=None):
fitness_hv = hypervolume_contrib(front)
for ind, fit_hv in zip(front, fitness_hv):
ind.fitness_hv.values = (fit_hv,)
# Fill chosen with best indiviuals from inspect front
# Fill chosen with best individuals from inspect front
# (based on hypervolume contribution)
chosen.extend(toolbox.select(front, MU - len(chosen)))
break
Expand Down
2 changes: 1 addition & 1 deletion examples/ga/onemax_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def evalOneMax(individual):
def cxTwoPointCopy(ind1, ind2):
"""Execute a two points crossover with copy on the input individuals. The
copy is required because the slicing in numpy returns a view of the data,
which leads to a self overwritting in the swap operation. It prevents
which leads to a self overwriting in the swap operation. It prevents
::
>>> import numpy
Expand Down
2 changes: 1 addition & 1 deletion examples/gp/ant.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def parse_matrix(self, matrix):
toolbox.register("population", tools.initRepeat, list, toolbox.individual)

def evalArtificialAnt(individual):
# Transform the tree expression to functionnal Python code
# Transform the tree expression to functional Python code
routine = gp.compile(individual, pset)
# Run the generated routine
ant.run(routine)
Expand Down

0 comments on commit fc8eeae

Please sign in to comment.