No, PySR and symbolic regression tools in general are not inherently equipped to identify recursive relationships or to output recursive functions. Symbolic regression is designed to search for explicit mathematical expressions that describe the relationship between input features and a target variable, without recursion.
Recursive relationships are fundamentally different because they describe a process where the output of one computation feeds into the next as input, which can continue indefinitely or until a certain condition is met. Symbolic regression algorithms like PySR typically look for patterns that map directly from independent variables to dependent variables, and they do not have a mechanism for expressing the kind of self-referential computations found in recursion.
Since PySR does not natively support recursion, it cannot naturally discover the iterative function used to generate the Mandelbrot set because the set is defined by the repeated application of a function to its own output.
To work around this limitation when using symbolic regression for problems involving recursion, you can:
- Transform recursive behavior into explicit patterns within a fixed number of iterations and create features that reflect information about that trajectory, as previously discussed.
- Use domain knowledge to create features that capture aspects of the recursive process, effectively "unrolling" the recursion into a form that a non-recursive model like symbolic regression can handle.
- Define a new problem where recursive aspects are not essential or can be captured through explicitly formulated relationships between features and target outcomes.
If you specifically need to identify or work with recursive relationships, other techniques such as genetic programming with custom-designed function sets or specialized machine learning methods tailored to sequence prediction might be more appropriate. Digital signal processing or time series analysis tools can also model recursive filters or autoregressive processes, which have a recursive structure.
Keep in mind that while PySR cannot find recursive functions, it may still be useful for gaining insight into non-recursive approximations of the dynamics over a fixed number of iterations or within a limited scope of behavior.