-
Notifications
You must be signed in to change notification settings - Fork 6
symbolic_regression_part1_bis
Manlio Morini edited this page Jul 29, 2023
·
15 revisions
Extension to multiple variables is straight-forward.
For example consider the
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<vita::real::ln>();
(for your ease the above code is in the examples/symbolic_regression01.cc file)
and what we get is:
[INFO] Reading dataset from input stream...
[INFO] ...dataset read. Examples: 8, categories: 0, features: 2, classes: 0
[INFO] Setting up terminals...
[INFO] ...terminals ready. Variables: `X1` `X2`
[INFO] Number of layers set to 1
[INFO] Population size set to 100
Run 0. 0 ( 0%): fitness (-107.645)
Run 0. 0 ( 1%): fitness (-102.444)
Run 0. 0 ( 3%): fitness (-88.5616)
Run 0. 0 ( 16%): fitness (-88.4484)
Run 0. 0 ( 19%): fitness (-67.8505)
Run 0. 0 ( 27%): fitness (-49.6343)
Run 0. 1 ( 87%): fitness (-31.0667)
Run 0. 20 ( 42%): fitness (-23.9684)
Run 0. 48 ( 6%): fitness (-20.1796)
Run 0. 51 ( 28%): fitness (-0.0174211)
[INFO] Elapsed time: 0.068s
[INFO] Training fitness: (-0.0174211)
CANDIDATE SOLUTION
log(((X1*X1)+(X2*X2)))
FITNESS
(-0.0174211)