Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

symbolic_regression_part1

Manlio Morini edited this page May 30, 2024 · 7 revisions

Symbolic regression - Multiple variables

Extension to multiple variables is straight-forward.

For example consider the $f(x,y) = ln(x^2 + y^2)$ function:

ln(x·x + y·y)

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>();

(for your ease the above code is in the examples/symbolic_regression/symbolic_regression01.cc file)

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

PROCEED TO PART 2→

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /