trevorstephens / gplearn

Genetic Programming in Python, with a scikit-learn inspired API

Home Page:http://gplearn.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Would there be a way to produce the equivalent Python code for the program coming from the symbolic regress or

c0def0x01 opened this issue · comments

Is there a way with gplearn to get the program provided by the symbolic regressor e.g. ˋsub(div(mul(X4, X12), div(X9, X9)), sub(div(X11, X12), add(X12, X0)))ˋ into an executable Python program e.g.

def prog(X0, X4, X9, X11, X12):
    return  … (X4 * X12) …

Would it be useful to enhance this in gplearn, or is there better ways to do this?

Not really sure what is gained here? The whole package has the functionality to essentially execute the program via the .predict methods.

The closest might be to extract the underlying _Program objects and work with those directly. I don't have any plans at this stage to make those object accessible via a public API at this stage though.

If you just want to use the program later, you can export it: https://gplearn.readthedocs.io/en/stable/advanced.html#exporting