## What does the formula $1-\sum_i(e_i-a_i)^2$ mean in this NEAT Python API?

2

I have looked at the documentation for the NEAT Python API found here, but it shows calculus like this:

The error for each genome is $$1-\sum_i(e_i-a_i)^2$$

I haven't learned calculus at the moment. So, can someone please explain what the calculation means?

Hi and welcome to this community! This website is better suited for more specific questions. For example, you could ask a question regarding a specific concept regarding NEAT. – nbro – 2019-04-19T14:09:40.487

@nbro Thanks! I have added more on what concepts are confusing me the most in a recent edit. – A Twizzler – 2019-04-19T14:59:35.490

I removed the rest of the post. I think the link to the Python API is not correct. – nbro – 2019-04-19T15:08:48.743

@nbro the link doesn't work or the source is wrong? – A Twizzler – 2019-04-19T15:28:47.647

There is no such formula at that link. – nbro – 2019-04-19T16:30:54.437

1

– Philip Raeisghasem – 2019-04-19T18:18:14.673

2

$$1-\sum_i(e_i-a_i)^2$$

$$\sum$$ - there just means sum. It is greek letter for S. You can rewrite the above formula as

$$1 -[(e_1 - a_1)^2+(e_2-a_2)^2+(e_3-a_3)^2+\ldots ]$$

$$\sum$$ just helps us avoid writing dozens of $$+$$ signs. Read more here.

What they are doing here is subtracting taking difference of expected value $$e_1$$ and the actual value $$a_1$$ for the 1st example and so on. The difference can be positive ($$e_1 > a_1$$) or negative ($$e_1 < a_1$$), so usually we square the difference to make it positive number.

The rest is there in the docs. Try putting in concrete imagined values for $$a_i$$ and $$e_i$$.

Thanks for contributing! – DukeZhou – 2019-11-14T20:41:00.003

0

The Sigma means that they take a sum of the squared difference of each pair of expected/predicted values (e) and actual values (a)

1 - that gives them an error metric of how far off they are from their desired result. The goal is generally to optimize the algorithms against such an error function, in this case, to get it as close to one as possible.

0

It sums the squared error for the output vs the expected output, this isnt something you need to do for each experiment they are simply telling you the metric they are using as fitness for the genomes in the xor example experiment, in other experiments you could use something else. If you were training it to play video games you set your fitness to be a numerical representation of how well the genome played the game, so you dont always need to have an expected value as long as your fitness function uses a meaningful metric as the fitness value.