Symbolic regression - Multiple variables
Extension to multiple variables is straight-forward.
For example consider the \(f(x,y) = ln(x^2 + y^2)\) function:
We only need to add a column to the input data:
std::istringstream training(R"(
-2.079, 0.25, 0.25
-0.693, 0.50, 0.50
0.693, 1.00, 1.00
0.000, 0.00, 1.00
0.000, 1.00, 0.00
1.609, 1.00, 2.00
1.609, 2.00, 1.00
2.079, 2.00, 2.00
)");
and a function to the function set:
prob.insert<real::ln>();
and what we get is:
[INFO] Reading dataset from input stream...
[INFO] Setting up terminals...
[INFO] ...terminals ready. Variables: `X1` `X2`
[INFO] ...dataset read. Examples: 8, categories: 1, features: 2, classes: 0
[INFO] Number of layers set to 1
[INFO] Population size set to 100
0: -51.9232 ( 0.196)
2: -23.9684 ( 0.587)
5: -20.1796 ( 1.206)
29: -20.1796 ( 6.604)
38: -12.9331 ( 8.893)
43: -0.0174211 ( 10.204)
[INFO] Evolution completed at generation: 102. Elapsed time: 28.313
CANDIDATE SOLUTION
log(((X2*X2)+(X1*X1)))
FITNESS
-0.0174211