As mentioned in the previous blog, through some effort we are able to manipulate the Gaussian Distribution’s standard deviation \(\sigma\) to make the mutation chance anything we want. I want to keep the heavy math to side blogs for the adventurous, so this is where we’ll find out how to define \(\sigma\) to get an arbitrary value for the mutation chance, which we’ll define as \(0 \lt \eta \lt 1 | \eta \in \mathbb{R}\).
We begin with the Gaussian Distribution, which can be given via
f(x) = \frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2} (\frac{x-\mu}{\sigma})^{2}}
\end{equation}
Now we apply some simple calculus to Equation \ref{eq:1} to find the cumulative probability function, or the probability that any number will be smaller than a given variable \(z\).
Now it might not be a surprise that Equation \ref{eq:1} is normalized, meaning \(\int_{-\infty}^{\infty} f(x)dx = 1\); after all, that is a property of a proper Probability Density Function. Thus, the CDF \(g(z)\) is given by
g(z) = \int_{-\infty}^{z+\mu}f(x)dx = \frac{1}{\sigma\sqrt{2\pi}} \int_{-\infty}^{z+\mu}e^{-\frac{1}{2}(\frac{x-\mu}{\sigma})^{2}} dx
\end{equation}
Aha! Here we start to see something we can use! Equation \ref{eq:2} bears a striking similarity to the Error function, given by
\text{erf}(x)=\frac{1}{\sqrt{\pi}}\int_{-x}^{x}e^{-t^2}dt
\end{equation}
We must thus transform Equation \ref{eq:2} to more closely reflect Equation \ref{eq:3}. We can do this by finding \(g(-z)\), which gives us
g(-z)= \frac{1}{\sigma\sqrt{2\pi}} \int_{-\infty}^{-z+\mu}e^{-\frac{1}{2}(\frac{x-\mu}{\sigma})^{2}} dx
\end{equation}
It is thus easy to see that our target function is given by \(g(z)-g(-z)\)
This simple subtraction will net us
1-\eta = g(z)-g(-z) = \frac{1}{\sigma\sqrt{2\pi}} \int_{-z+\mu}^{z+\mu}e^{-\frac{1}{2}(\frac{x-\mu}{\sigma})^{2}} dx
\end{equation}
With some simple algebraic manipulation, we can transform this to mirror the error function, namely through \(t=\frac{1}{\sqrt{2}} \frac{x-\mu}{\sigma}\) and temporarily shifting the function such that \(\mu=0\), we get
1-\eta = \frac{1}{\sigma\sqrt{2\pi}} \left(\frac{1}{\sigma\sqrt{2}}\right) \int_{-z’}^{z’}e^{-t^2}dt=\frac{1}{2\sigma^2}\text{erf}(z’)
\end{equation}
Where \(z’ = \frac{z}{\sigma\sqrt{2}}\). Now, if we assign \(z=n\sigma\), then \(z’=\frac{n}{\sqrt{2}}\), thus
1 – \eta = \frac{1}{2 \sigma^2}\text{erf}\left(\frac{n}{\sqrt{2}}\right)
\end{equation}
This next part is going to make the mathematicians among you recoil with horror, but I’m going to power through anyway. First, we set \(\sigma^{2}=\frac{1}{2}\) to get rid of anything that isn’t the error function. This is because \(\text{erf}(\infty) = 1\), so to satisfy Equation \ref{eq:7} assuming \(n=\infty\) then we have to set \(\sigma^{2}=\frac{1}{2}\). Now we solve for \(n\) numerically. Which method you use isn’t really important. To preface the next step, we will now define \(m=-n\sigma+\mu\) and \(d=n\sigma+\mu\) with \(\mu=\frac{m+d}{2}\), which you might notice is their mean. Here, we will now replace the following value for \(\sigma\)
\sigma = \frac{d-m}{2n}
\end{equation}
I can’t really say I derived at this equation, I pulled it out of thin air through observations and some educated guesses. Please let me know if you can derive this equation from everything above, I would be very interested and pleased to read it. Nevertheless, with this final modification our resulting Gaussian distribution with mean \(\mu\) and standard deviation \(\sigma\) will give a \(1-\eta\) probability to fall between \(m\) and \(d\), and a \(\eta\) chance to fall outside of these values. This is significant for the crossover function as mentioned in my previous blog, as it allows us to change the distribution to allow for arbitrary mutation chance \(\eta\)