DEAP / deap

Distributed Evolutionary Algorithms in Python
http://deap.readthedocs.org/
GNU Lesser General Public License v3.0
5.87k stars 1.13k forks source link

:memo: Symbolic Regression Tutorial: Add clarity on eval function values #600

Open jameshughes89 opened 3 years ago

jameshughes89 commented 3 years ago

Adding more detail on how the evaluation function works and what one would replace the hard coded function with. The point that is trying to be communicated is that the polynomial is used to calculate y^ on the fly. If someone had arbitrary data for the dependent and independent variables, they would use these values instead.

These details are added based on my observation of where my class is misunderstanding how to use GP for symbolic regression.

jameshughes89 commented 3 years ago

Hmm... I see what you mean --- it does feel like the additional details makes it just more confusing.

I'm not sure if the added note really improves clarity. Maybe we'd need to change a bit the example to highlight that the quartic is the "external" reference system.

Perhaps the easiest way is to pre-generate the data and store it in a list that is indexed within the evaluation function.

Either way, I'll let the ideas brew a little before I move on this any more.

jameshughes89 commented 2 years ago

I am struggling on the best way to approach this.

My current thinking is to create an additional function that returns a list of values from the function f(x) = x**4 + x**3 + x**2 + x and passing that to the evalSymbReg function (e.g. below). This would then allow for a note in the documentation that the data being input to the function can obtained from wherever (like a csv). Let me know if this makes sense. If so, I will proceed.

def getSomeFunctionData():
    data = []
    for x in range(-10, 10):
        data.append((x/10)**4 + (x/10)**3 + (x/10)**2 + (x/10))
    return data