Next, we’ll discuss the particle filter, a type of genetic algorithm that is also used for self-driving cars as well as time series. By genetic algorithm, I mean that we apply natural selection to improve our estimates. This will become more clear in a bit. Let’s start with a thought experiment. Imagine that we can hire many little helpers, each with a certain view on where the stock returns are going based on market data. Each of these little helpers predict the stock return for the next day, and on the following day, you can see how correct they were. Each day, you pay more to the little helpers who are correct and pay less to the incorrect helpers. Over time, only the accurate helpers remain to make predictions. So by the process of natural selection, we find the helpers who are most accurate and average their predictions as your best estimate. Since this process looks like natural selection and evolution, particle filters are considered a type of genetic algorithm. The little helpers are called particles. These particles are individual models whose parameters are set randomly. When most particles make very similar predictions, this also shows more confidence in the average prediction. When there are significant changes in the data distribution at any point in time, the particles may make predictions that are more different from each other. In those cases, when the individual predictions are more spread out, we are less confident of the prediction. Particle filters are pretty good at handling a variety of data because they don’t assume the data to be normally distributed. Particle filters also do not assume a linear relationship, so they can better fit non-linear data.