Differential Evolution › Visualizing Differential Evolution
Machine Learning from ScratchAll chapters Differential Evolution › Visualizing Differential EvolutionSection view · Sections in this chapter7 / 10 ↓
Reading tools Definitions, links & notes
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
When we call scipy.optimize.differential_evolution, a few of its arguments map onto the mechanics we derived:
init="random"uses random box initialization. SciPy also offers Latin hypercube initialization or an explicit initial population.polish=Falsedisables the additional local-polishing phase in our reference comparison. If polishing is enabled, count its evaluations as well.tolandatoltest population-energy spread against , not against the best value or distance to the optimum. Setting both to zero still allows termination when the spread is exactly zero.updating="deferred"uses the old population for the generation. Parallel or vectorized evaluation requires this convention.rngcontrols SciPy's random-number generator. Reproducibility also depends on the runtime, objective, and execution settings.
For seeds 0 through 19, all three methods evaluate exactly 3000 candidates. A vectorized objective call evaluating 20 rows counts as 20 candidate evaluations, not one Python invocation. The Nelder-Mead baseline uses the same box bounds, limits each local restart to at most 200 evaluations, and keeps a global incumbent across restarts. This restart cap is a disclosed baseline choice, not a tuned guarantee.
VisualizationOut [13]Expand

These are median incumbent traces on one synthetic two-dimensional objective. Read the curve together with the final-value distribution: an early improvement in a median trace does not mean every seed reached that value. The random-search baseline continues drawing across the box, while the restarted local baseline divides its budget among local searches. Their relative outcomes describe this particular box, objective, restart cap, and budget.
ConsoleOut [14]Expand
method min/max evaluations median best worst best success rate (<1e-6)
DE/rand/1/bin 3000/3000 1.228e-20 9.950e-01 9.000e-01
Random search 3000/3000 1.118e+00 2.041e+00 0.000e+00
Multistart Nelder-Mead 3000/3000 9.950e-01 3.980e+00 5.000e-02The table reports actual per-seed evaluation counts, median and worst observed final values, and the fraction below the prespecified threshold. That threshold means a small objective value on this example, not an optimality certificate. A worst observed value is the maximum among these seeds, not a bound on future runs.
Individual final values expose the variation hidden by a median. The plot uses the same twenty seeds and 3000-candidate budget as the comparison. Values below the display floor share a plotted level even when their computed values differ.
VisualizationOut [16]Expand

The next four snapshots show one recorded seed at initialization, after ten and thirty generations, and at the end. They use the same axes so contraction remains visible; a small display margin outside the contour box prevents boundary markers from being clipped. This is one trajectory, not a claim that every seed follows the same basins or timing. The 300-by-300 contour grid requires 90,000 visualization-only candidate evaluations. Those values are not available to any search method and are separate from every search budget.
VisualizationsOut [18]Expand




Compare the four snapshots with the recorded evaluation indices. If the points concentrate, their donor differences become shorter without changing . The contour background supplies objective context, but the snapshots alone do not identify which proposal caused an improvement or establish a general convergence rate.
The final heatmap varies and at a fixed budget of 1500 candidates, including initialization. Every cell is a median over seeds 0 through 4 on the same synthetic objective. It shows local sensitivity to these choices; it does not estimate a universal best setting.
VisualizationOut [20]Expand

The cells summarize measured outcomes, not an assumed explanation for them. A small median difference across five seeds is weak evidence for a ranking. A poor result can reflect the starting population, finite budget, bounds, and operator settings together; this sweep does not isolate a universal causal rule.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!