Open ArnoStrouwen opened 2 years ago
Also,
using DataDrivenDiffEq
using SymbolicRegression
X = rand(2,10)
Y = rand(2,10)
opts = EQSearch([+, *, /, ^, cos, exp, log], maxdepth=15, progress = true, verbosity = 1)
prob = DirectDataDrivenProblem(X, Y)
res = solve(prob, opts, numprocs = 0, multithreading = false)
(@v1.7) pkg> resolve
No Changes to `C:\Users\arno\.julia\environments\v1.7\Project.toml`
No Changes to `C:\Users\arno\.julia\environments\v1.7\Manifest.toml`
(@v1.7) pkg> activate .
Activating project at `C:\Users\arno\Koofr\solubility`
(solubility) pkg> resolve
No Changes to `C:\Users\arno\Koofr\solubility\Project.toml`
No Changes to `C:\Users\arno\Koofr\solubility\Manifest.toml`
julia> using DataDrivenDiffEq
julia> using SymbolicRegression
┌ Warning: Package DataDrivenDiffEq does not have SymbolicRegression in its dependencies:
│ - If you have DataDrivenDiffEq checked out for development and have
│ added SymbolicRegression as a dependency but haven't updated your primary
│ environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with DataDrivenDiffEq
└ Loading SymbolicRegression into DataDrivenDiffEq from project dependency, future warnings for DataDrivenDiffEq are suppressed.
[ Info: DataDrivenDiffEq : Symboolic Regression is available.
julia>
julia> X = rand(2,10)
2×10 Matrix{Float64}:
0.9614 0.210828 0.650029 0.96881 0.994515 0.932444 0.183441 0.249941 0.351275 0.0437692
0.00255886 0.38182 0.773483 0.0148445 0.691982 0.443247 0.769277 0.155514 0.305426 0.729765
julia> Y = rand(2,10)
2×10 Matrix{Float64}:
0.904251 0.383732 0.58345 0.287408 0.104666 0.189604 0.429889 0.633914 0.86294 0.807212
0.0983475 0.0544139 0.736205 0.242866 0.162755 0.863066 0.708931 0.670905 0.685196 0.182106
julia>
julia> opts = EQSearch([+, *, /, ^, cos, exp, log], maxdepth=15, progress = true, verbosity = 1)
EQSearch(Function[+, *, /, ^, cos, exp, log], Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:maxdepth, :progress, :verbosity), Tuple{Int64, Bool, Int64}}}(:maxdepth => 15, :progress => true, :verbosity => 1))
julia> prob = DirectDataDrivenProblem(X, Y)
Direct DataDrivenProblem{Float64}
julia> res = solve(prob, opts, numprocs = 0, multithreading = false)
Started!
Cycles per second: 5.650e+03
Head worker occupation: 95.0%
Progress: 1 / 20 total iterations (5.000%)
==============================
Best equations for output 1
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
==============================
Best equations for output 2
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 9.091e-02 -9.957e-03 0.41046748
2 9.001e-02 9.957e-03 exp(-0.81983465)
5 8.690e-02 1.172e-02 exp(-0.67575574 / cos(x1))
7 8.384e-02 1.793e-02 exp(-0.67575574 / pow(cos(x1), x1))
9 7.730e-02 4.060e-02 exp(-0.67575574 / pow(cos(x1) + x2, x1))
11 7.590e-02 9.141e-03 (exp(-0.67575574 / cos(pow(pow(x1, x1), 2.7216995))) + 0.028856449)
12 6.917e-02 9.285e-02 exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1))))
14 6.763e-02 1.128e-02 (exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1)))) + 0.028856449)
16 6.719e-02 3.281e-03 exp(-0.67575574 / cos(pow(pow(x1, 1.2391932), 2.3682861 + (log_abs(x1 + x1) + x1))))
18 5.340e-02 1.148e-01 exp(-0.6901733 / cos(pow(pow(x1, 2.6648421), pow(x1, x2) + (log_abs(x1 + x1) + x1))))
20 4.810e-02 5.223e-02 (0.067492224 + exp(-0.67770845 / cos(pow(pow(x1, 2.6648421), x1 + (log_abs(2.0 * x1) + pow(x1, x2))))))
==============================
Cycles per second: 6.090e+03
Head worker occupation: 93.4%
Progress: 3 / 20 total iterations (15.000%)
==============================
Best equations for output 1
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
3 7.485e-02 -9.612e-03 exp(log_abs(0.5648296))
4 7.279e-02 2.786e-02 log_abs(log_abs(cos(-1.7609845)))
5 5.739e-02 2.378e-01 pow(0.56898147, x1 + x2)
6 5.560e-02 3.165e-02 exp((x1 + x2) * -0.5914393)
7 4.954e-02 1.154e-01 (0.56898147 / (x1 + pow(x2, 0.3879204)))
9 4.908e-02 4.649e-03 (0.56898147 / ((x1 / 1.0900214) + pow(x2, 0.3879204)))
11 4.497e-02 4.377e-02 pow(-0.60748357 / pow(x1 + pow(x2, 0.3879204), x1), 1.0520971)
13 4.398e-02 1.108e-02 (0.56898147 / pow(pow(x1 / 1.0832202, 1.6902311) + pow(x2, 0.3879204), x1))
14 4.096e-02 7.128e-02 pow(-0.64341474 / pow(x1 + pow(x2, 0.3879204), x1 / cos(x1)), 1.233749)
15 4.072e-02 5.696e-03 pow(-0.5729236 / pow(pow(x1, 1.6902311) + pow(x2, 0.3879204), x1 / 0.58648014), 1.0520971)
17 3.463e-02 8.102e-02 (0.5558381 / pow((pow(x1 / 1.0832202, 1.6902311) * x1) + pow(x2, 0.3879204), x1 / 0.58559114))
18 3.035e-02 1.320e-01 pow(0.67135197 / pow(pow(x1 / -1.0679302, 2.1311643) + pow(x2, 0.35148922), x1 / cos(x1)), 1.4499243)
20 2.632e-02 7.120e-02 pow(-0.69117373 / pow((x1 * pow(-0.93861735 * x1, 2.3912585)) + pow(x2, 0.33060548), x1 / cos(x1)), 1.5952356)
==============================
Best equations for output 2
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 9.091e-02 -9.957e-03 0.41046748
2 9.001e-02 9.957e-03 exp(-0.81983465)
5 8.690e-02 1.172e-02 exp(-0.67575574 / cos(x1))
7 8.384e-02 1.793e-02 exp(-0.67575574 / pow(cos(x1), x1))
9 7.730e-02 4.060e-02 exp(-0.67575574 / pow(cos(x1) + x2, x1))
11 7.590e-02 9.141e-03 (exp(-0.67575574 / cos(pow(pow(x1, x1), 2.7216995))) + 0.028856449)
12 6.917e-02 9.285e-02 exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1))))
14 6.763e-02 1.128e-02 (exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1)))) + 0.028856449)
16 6.719e-02 3.281e-03 exp(-0.67575574 / cos(pow(pow(x1, 1.2391932), 2.3682861 + (log_abs(x1 + x1) + x1))))
18 5.340e-02 1.148e-01 exp(-0.6901733 / cos(pow(pow(x1, 2.6648421), pow(x1, x2) + (log_abs(x1 + x1) + x1))))
20 4.810e-02 5.223e-02 (0.067492224 + exp(-0.67770845 / cos(pow(pow(x1, 2.6648421), x1 + (log_abs(2.0 * x1) + pow(x1, x2))))))
==============================
Cycles per second: 6.240e+03
Head worker occupation: 95.7%
Progress: 5 / 20 total iterations (25.000%)
==============================
Best equations for output 1
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
3 7.485e-02 -9.612e-03 exp(log_abs(0.5648296))
4 7.279e-02 2.786e-02 log_abs(log_abs(cos(-1.7609845)))
5 5.739e-02 2.378e-01 pow(0.56898147, x1 + x2)
6 5.560e-02 3.165e-02 exp((x1 + x2) * -0.5914393)
7 4.954e-02 1.154e-01 (0.56898147 / (x1 + pow(x2, 0.3879204)))
9 4.908e-02 4.649e-03 (0.56898147 / ((x1 / 1.0900214) + pow(x2, 0.3879204)))
11 4.497e-02 4.377e-02 pow(-0.60748357 / pow(x1 + pow(x2, 0.3879204), x1), 1.0520971)
13 4.398e-02 1.108e-02 (0.56898147 / pow(pow(x1 / 1.0832202, 1.6902311) + pow(x2, 0.3879204), x1))
14 4.096e-02 7.128e-02 pow(-0.64341474 / pow(x1 + pow(x2, 0.3879204), x1 / cos(x1)), 1.233749)
15 4.072e-02 5.696e-03 pow(-0.5729236 / pow(pow(x1, 1.6902311) + pow(x2, 0.3879204), x1 / 0.58648014), 1.0520971)
17 3.463e-02 8.102e-02 (0.5558381 / pow((pow(x1 / 1.0832202, 1.6902311) * x1) + pow(x2, 0.3879204), x1 / 0.58559114))
18 3.035e-02 1.320e-01 pow(0.67135197 / pow(pow(x1 / -1.0679302, 2.1311643) + pow(x2, 0.35148922), x1 / cos(x1)), 1.4499243)
20 2.632e-02 7.120e-02 pow(-0.69117373 / pow((x1 * pow(-0.93861735 * x1, 2.3912585)) + pow(x2, 0.33060548), x1 / cos(x1)), 1.5952356)
==============================
Best equations for output 2
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 9.091e-02 -9.957e-03 0.41046748
2 9.001e-02 9.957e-03 exp(-0.81983465)
5 8.690e-02 1.172e-02 exp(-0.67575574 / cos(x1))
7 8.384e-02 1.793e-02 exp(-0.67575574 / pow(cos(x1), x1))
9 7.730e-02 4.060e-02 exp(-0.67575574 / pow(cos(x1) + x2, x1))
11 7.590e-02 9.141e-03 (exp(-0.67575574 / cos(pow(pow(x1, x1), 2.7216995))) + 0.028856449)
12 6.917e-02 9.285e-02 exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1))))
14 6.763e-02 1.128e-02 (exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1)))) + 0.028856449)
16 6.719e-02 3.281e-03 exp(-0.67575574 / cos(pow(pow(x1, 1.2391932), 2.3682861 + (log_abs(x1 + x1) + x1))))
18 5.340e-02 1.148e-01 exp(-0.6901733 / cos(pow(pow(x1, 2.6648421), pow(x1, x2) + (log_abs(x1 + x1) + x1))))
20 4.810e-02 5.223e-02 (0.067492224 + exp(-0.67770845 / cos(pow(pow(x1, 2.6648421), x1 + (log_abs(2.0 * x1) + pow(x1, x2))))))
==============================
Cycles per second: 6.270e+03
Head worker occupation: 96.9%
Progress: 7 / 20 total iterations (35.000%)
==============================
Best equations for output 1
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
3 7.485e-02 -9.612e-03 exp(log_abs(0.5648296))
4 7.279e-02 2.786e-02 log_abs(log_abs(cos(-1.7609845)))
5 5.739e-02 2.378e-01 pow(0.56898147, x1 + x2)
6 5.560e-02 3.165e-02 exp((x1 + x2) * -0.5914393)
7 4.954e-02 1.154e-01 (0.56898147 / (x1 + pow(x2, 0.3879204)))
9 4.908e-02 4.649e-03 (0.56898147 / ((x1 / 1.0900214) + pow(x2, 0.3879204)))
11 4.497e-02 4.377e-02 pow(-0.60748357 / pow(x1 + pow(x2, 0.3879204), x1), 1.0520971)
13 4.398e-02 1.108e-02 (0.56898147 / pow(pow(x1 / 1.0832202, 1.6902311) + pow(x2, 0.3879204), x1))
14 4.096e-02 7.128e-02 pow(-0.64341474 / pow(x1 + pow(x2, 0.3879204), x1 / cos(x1)), 1.233749)
15 4.072e-02 5.696e-03 pow(-0.5729236 / pow(pow(x1, 1.6902311) + pow(x2, 0.3879204), x1 / 0.58648014), 1.0520971)
17 3.463e-02 8.102e-02 (0.5558381 / pow((pow(x1 / 1.0832202, 1.6902311) * x1) + pow(x2, 0.3879204), x1 / 0.58559114))
18 3.035e-02 1.320e-01 pow(0.67135197 / pow(pow(x1 / -1.0679302, 2.1311643) + pow(x2, 0.35148922), x1 / cos(x1)), 1.4499243)
20 2.632e-02 7.120e-02 pow(-0.69117373 / pow((x1 * pow(-0.93861735 * x1, 2.3912585)) + pow(x2, 0.33060548), x1 / cos(x1)), 1.5952356)
==============================
Best equations for output 2
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 9.091e-02 -9.957e-03 0.41046748
2 9.001e-02 9.957e-03 exp(-0.81983465)
5 8.690e-02 1.172e-02 exp(-0.67575574 / cos(x1))
7 8.384e-02 1.793e-02 exp(-0.67575574 / pow(cos(x1), x1))
9 7.730e-02 4.060e-02 exp(-0.67575574 / pow(cos(x1) + x2, x1))
11 7.590e-02 9.141e-03 (exp(-0.67575574 / cos(pow(pow(x1, x1), 2.7216995))) + 0.028856449)
12 6.917e-02 9.285e-02 exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1))))
14 6.763e-02 1.128e-02 (exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1)))) + 0.028856449)
16 6.719e-02 3.281e-03 exp(-0.67575574 / cos(pow(pow(x1, 1.2391932), 2.3682861 + (log_abs(x1 + x1) + x1))))
18 5.340e-02 1.148e-01 exp(-0.6901733 / cos(pow(pow(x1, 2.6648421), pow(x1, x2) + (log_abs(x1 + x1) + x1))))
20 4.810e-02 5.223e-02 (0.067492224 + exp(-0.67770845 / cos(pow(pow(x1, 2.6648421), x1 + (log_abs(2.0 * x1) + pow(x1, x2))))))
==============================
Cycles per second: 6.290e+03
Head worker occupation: 97.5%
Progress: 9 / 20 total iterations (45.000%)
==============================
Best equations for output 1
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
3 7.485e-02 -9.612e-03 exp(log_abs(0.5648296))
4 7.279e-02 2.786e-02 log_abs(log_abs(cos(-1.7609845)))
5 5.739e-02 2.378e-01 pow(0.56898147, x1 + x2)
6 5.560e-02 3.165e-02 exp((x1 + x2) * -0.5914393)
7 4.954e-02 1.154e-01 (0.56898147 / (x1 + pow(x2, 0.3879204)))
9 4.908e-02 4.649e-03 (0.56898147 / ((x1 / 1.0900214) + pow(x2, 0.3879204)))
11 4.497e-02 4.377e-02 pow(-0.60748357 / pow(x1 + pow(x2, 0.3879204), x1), 1.0520971)
13 4.398e-02 1.108e-02 (0.56898147 / pow(pow(x1 / 1.0832202, 1.6902311) + pow(x2, 0.3879204), x1))
14 4.096e-02 7.128e-02 pow(-0.64341474 / pow(x1 + pow(x2, 0.3879204), x1 / cos(x1)), 1.233749)
15 4.072e-02 5.696e-03 pow(-0.5729236 / pow(pow(x1, 1.6902311) + pow(x2, 0.3879204), x1 / 0.58648014), 1.0520971)
17 3.463e-02 8.102e-02 (0.5558381 / pow((pow(x1 / 1.0832202, 1.6902311) * x1) + pow(x2, 0.3879204), x1 / 0.58559114))
18 3.035e-02 1.320e-01 pow(0.67135197 / pow(pow(x1 / -1.0679302, 2.1311643) + pow(x2, 0.35148922), x1 / cos(x1)), 1.4499243)
20 2.632e-02 7.120e-02 pow(-0.69117373 / pow((x1 * pow(-0.93861735 * x1, 2.3912585)) + pow(x2, 0.33060548), x1 / cos(x1)), 1.5952356)
==============================
Best equations for output 2
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 9.091e-02 -9.957e-03 0.41046748
2 9.001e-02 9.957e-03 exp(-0.81983465)
5 8.690e-02 1.172e-02 exp(-0.67575574 / cos(x1))
7 8.384e-02 1.793e-02 exp(-0.67575574 / pow(cos(x1), x1))
9 7.730e-02 4.060e-02 exp(-0.67575574 / pow(cos(x1) + x2, x1))
11 7.590e-02 9.141e-03 (exp(-0.67575574 / cos(pow(pow(x1, x1), 2.7216995))) + 0.028856449)
12 6.917e-02 9.285e-02 exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1))))
14 6.763e-02 1.128e-02 (exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1)))) + 0.028856449)
16 6.719e-02 3.281e-03 exp(-0.67575574 / cos(pow(pow(x1, 1.2391932), 2.3682861 + (log_abs(x1 + x1) + x1))))
18 5.340e-02 1.148e-01 exp(-0.6901733 / cos(pow(pow(x1, 2.6648421), pow(x1, x2) + (log_abs(x1 + x1) + x1))))
20 4.810e-02 5.223e-02 (0.067492224 + exp(-0.67770845 / cos(pow(pow(x1, 2.6648421), x1 + (log_abs(2.0 * x1) + pow(x1, x2))))))
==============================
Cycles per second: 6.320e+03
Head worker occupation: 97.9%
Progress: 11 / 20 total iterations (55.000%)
==============================
Best equations for output 1
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
3 7.485e-02 -9.612e-03 exp(log_abs(0.5648296))
4 7.279e-02 2.786e-02 log_abs(log_abs(cos(-1.7609845)))
5 5.739e-02 2.378e-01 pow(0.56898147, x1 + x2)
6 5.560e-02 3.165e-02 exp((x1 + x2) * -0.5914393)
7 4.954e-02 1.154e-01 (0.56898147 / (x1 + pow(x2, 0.3879204)))
9 4.908e-02 4.649e-03 (0.56898147 / ((x1 / 1.0900214) + pow(x2, 0.3879204)))
11 4.497e-02 4.377e-02 pow(-0.60748357 / pow(x1 + pow(x2, 0.3879204), x1), 1.0520971)
13 4.398e-02 1.108e-02 (0.56898147 / pow(pow(x1 / 1.0832202, 1.6902311) + pow(x2, 0.3879204), x1))
14 4.096e-02 7.128e-02 pow(-0.64341474 / pow(x1 + pow(x2, 0.3879204), x1 / cos(x1)), 1.233749)
15 4.072e-02 5.696e-03 pow(-0.5729236 / pow(pow(x1, 1.6902311) + pow(x2, 0.3879204), x1 / 0.58648014), 1.0520971)
17 3.463e-02 8.102e-02 (0.5558381 / pow((pow(x1 / 1.0832202, 1.6902311) * x1) + pow(x2, 0.3879204), x1 / 0.58559114))
18 3.035e-02 1.320e-01 pow(0.67135197 / pow(pow(x1 / -1.0679302, 2.1311643) + pow(x2, 0.35148922), x1 / cos(x1)), 1.4499243)
20 2.632e-02 7.120e-02 pow(-0.69117373 / pow((x1 * pow(-0.93861735 * x1, 2.3912585)) + pow(x2, 0.33060548), x1 / cos(x1)), 1.5952356)
==============================
Best equations for output 2
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 9.091e-02 -9.957e-03 0.41046748
2 9.001e-02 9.957e-03 exp(-0.81983465)
5 8.690e-02 1.172e-02 exp(-0.67575574 / cos(x1))
7 8.384e-02 1.793e-02 exp(-0.67575574 / pow(cos(x1), x1))
9 7.730e-02 4.060e-02 exp(-0.67575574 / pow(cos(x1) + x2, x1))
11 7.590e-02 9.141e-03 (exp(-0.67575574 / cos(pow(pow(x1, x1), 2.7216995))) + 0.028856449)
12 6.917e-02 9.285e-02 exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1))))
14 6.763e-02 1.128e-02 (exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1)))) + 0.028856449)
16 6.719e-02 3.281e-03 exp(-0.67575574 / cos(pow(pow(x1, 1.2391932), 2.3682861 + (log_abs(x1 + x1) + x1))))
18 5.340e-02 1.148e-01 exp(-0.6901733 / cos(pow(pow(x1, 2.6648421), pow(x1, x2) + (log_abs(x1 + x1) + x1))))
20 4.810e-02 5.223e-02 (0.067492224 + exp(-0.67770845 / cos(pow(pow(x1, 2.6648421), x1 + (log_abs(2.0 * x1) + pow(x1, x2))))))
==============================
Cycles per second: 6.330e+03
Head worker occupation: 98.2%
Progress: 13 / 20 total iterations (65.000%)
==============================
Best equations for output 1
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
3 7.485e-02 -9.612e-03 exp(log_abs(0.5648296))
4 7.279e-02 2.786e-02 log_abs(log_abs(cos(-1.7609845)))
5 5.739e-02 2.378e-01 pow(0.56898147, x1 + x2)
6 5.560e-02 3.165e-02 exp((x1 + x2) * -0.5914393)
7 4.954e-02 1.154e-01 (0.56898147 / (x1 + pow(x2, 0.3879204)))
9 4.908e-02 4.649e-03 (0.56898147 / ((x1 / 1.0900214) + pow(x2, 0.3879204)))
11 4.497e-02 4.377e-02 pow(-0.60748357 / pow(x1 + pow(x2, 0.3879204), x1), 1.0520971)
13 4.398e-02 1.108e-02 (0.56898147 / pow(pow(x1 / 1.0832202, 1.6902311) + pow(x2, 0.3879204), x1))
14 4.096e-02 7.128e-02 pow(-0.64341474 / pow(x1 + pow(x2, 0.3879204), x1 / cos(x1)), 1.233749)
15 4.072e-02 5.696e-03 pow(-0.5729236 / pow(pow(x1, 1.6902311) + pow(x2, 0.3879204), x1 / 0.58648014), 1.0520971)
17 3.463e-02 8.102e-02 (0.5558381 / pow((pow(x1 / 1.0832202, 1.6902311) * x1) + pow(x2, 0.3879204), x1 / 0.58559114))
18 3.035e-02 1.320e-01 pow(0.67135197 / pow(pow(x1 / -1.0679302, 2.1311643) + pow(x2, 0.35148922), x1 / cos(x1)), 1.4499243)
20 2.632e-02 7.120e-02 pow(-0.69117373 / pow((x1 * pow(-0.93861735 * x1, 2.3912585)) + pow(x2, 0.33060548), x1 / cos(x1)), 1.5952356)
==============================
Best equations for output 2
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 9.091e-02 -9.957e-03 0.41046748
2 9.001e-02 9.957e-03 exp(-0.81983465)
5 8.690e-02 1.172e-02 exp(-0.67575574 / cos(x1))
7 8.384e-02 1.793e-02 exp(-0.67575574 / pow(cos(x1), x1))
9 7.730e-02 4.060e-02 exp(-0.67575574 / pow(cos(x1) + x2, x1))
11 7.590e-02 9.141e-03 (exp(-0.67575574 / cos(pow(pow(x1, x1), 2.7216995))) + 0.028856449)
12 6.917e-02 9.285e-02 exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1))))
14 6.763e-02 1.128e-02 (exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1)))) + 0.028856449)
16 6.719e-02 3.281e-03 exp(-0.67575574 / cos(pow(pow(x1, 1.2391932), 2.3682861 + (log_abs(x1 + x1) + x1))))
18 5.340e-02 1.148e-01 exp(-0.6901733 / cos(pow(pow(x1, 2.6648421), pow(x1, x2) + (log_abs(x1 + x1) + x1))))
20 4.810e-02 5.223e-02 (0.067492224 + exp(-0.67770845 / cos(pow(pow(x1, 2.6648421), x1 + (log_abs(2.0 * x1) + pow(x1, x2))))))
==============================
Cycles per second: 6.340e+03
Head worker occupation: 98.4%
Progress: 15 / 20 total iterations (75.000%)
==============================
Best equations for output 1
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
3 7.485e-02 -9.612e-03 exp(log_abs(0.5648296))
4 7.279e-02 2.786e-02 log_abs(log_abs(cos(-1.7609845)))
5 5.739e-02 2.378e-01 pow(0.56898147, x1 + x2)
6 5.560e-02 3.165e-02 exp((x1 + x2) * -0.5914393)
7 4.954e-02 1.154e-01 (0.56898147 / (x1 + pow(x2, 0.3879204)))
9 4.908e-02 4.649e-03 (0.56898147 / ((x1 / 1.0900214) + pow(x2, 0.3879204)))
11 4.497e-02 4.377e-02 pow(-0.60748357 / pow(x1 + pow(x2, 0.3879204), x1), 1.0520971)
13 4.398e-02 1.108e-02 (0.56898147 / pow(pow(x1 / 1.0832202, 1.6902311) + pow(x2, 0.3879204), x1))
14 4.096e-02 7.128e-02 pow(-0.64341474 / pow(x1 + pow(x2, 0.3879204), x1 / cos(x1)), 1.233749)
15 4.072e-02 5.696e-03 pow(-0.5729236 / pow(pow(x1, 1.6902311) + pow(x2, 0.3879204), x1 / 0.58648014), 1.0520971)
17 3.463e-02 8.102e-02 (0.5558381 / pow((pow(x1 / 1.0832202, 1.6902311) * x1) + pow(x2, 0.3879204), x1 / 0.58559114))
18 3.035e-02 1.320e-01 pow(0.67135197 / pow(pow(x1 / -1.0679302, 2.1311643) + pow(x2, 0.35148922), x1 / cos(x1)), 1.4499243)
20 2.632e-02 7.120e-02 pow(-0.69117373 / pow((x1 * pow(-0.93861735 * x1, 2.3912585)) + pow(x2, 0.33060548), x1 / cos(x1)), 1.5952356)
==============================
Best equations for output 2
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 9.091e-02 -9.957e-03 0.41046748
2 9.001e-02 9.957e-03 exp(-0.81983465)
5 8.690e-02 1.172e-02 exp(-0.67575574 / cos(x1))
7 8.384e-02 1.793e-02 exp(-0.67575574 / pow(cos(x1), x1))
9 7.730e-02 4.060e-02 exp(-0.67575574 / pow(cos(x1) + x2, x1))
11 7.590e-02 9.141e-03 (exp(-0.67575574 / cos(pow(pow(x1, x1), 2.7216995))) + 0.028856449)
12 6.917e-02 9.285e-02 exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1))))
14 6.763e-02 1.128e-02 (exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1)))) + 0.028856449)
16 6.719e-02 3.281e-03 exp(-0.67575574 / cos(pow(pow(x1, 1.2391932), 2.3682861 + (log_abs(x1 + x1) + x1))))
18 5.340e-02 1.148e-01 exp(-0.6901733 / cos(pow(pow(x1, 2.6648421), pow(x1, x2) + (log_abs(x1 + x1) + x1))))
20 4.810e-02 5.223e-02 (0.067492224 + exp(-0.67770845 / cos(pow(pow(x1, 2.6648421), x1 + (log_abs(2.0 * x1) + pow(x1, x2))))))
==============================
Cycles per second: 6.310e+03
Head worker occupation: 98.6%
Progress: 17 / 20 total iterations (85.000%)
==============================
Best equations for output 1
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
3 7.485e-02 -9.612e-03 exp(log_abs(0.5648296))
4 7.279e-02 2.786e-02 log_abs(log_abs(cos(-1.7609845)))
5 5.739e-02 2.378e-01 pow(0.56898147, x1 + x2)
6 5.560e-02 3.165e-02 exp((x1 + x2) * -0.5914393)
7 4.954e-02 1.154e-01 (0.56898147 / (x1 + pow(x2, 0.3879204)))
9 4.908e-02 4.649e-03 (0.56898147 / ((x1 / 1.0900214) + pow(x2, 0.3879204)))
11 4.497e-02 4.377e-02 pow(-0.60748357 / pow(x1 + pow(x2, 0.3879204), x1), 1.0520971)
13 4.398e-02 1.108e-02 (0.56898147 / pow(pow(x1 / 1.0832202, 1.6902311) + pow(x2, 0.3879204), x1))
14 4.096e-02 7.128e-02 pow(-0.64341474 / pow(x1 + pow(x2, 0.3879204), x1 / cos(x1)), 1.233749)
15 4.072e-02 5.696e-03 pow(-0.5729236 / pow(pow(x1, 1.6902311) + pow(x2, 0.3879204), x1 / 0.58648014), 1.0520971)
17 3.463e-02 8.102e-02 (0.5558381 / pow((pow(x1 / 1.0832202, 1.6902311) * x1) + pow(x2, 0.3879204), x1 / 0.58559114))
18 3.035e-02 1.320e-01 pow(0.67135197 / pow(pow(x1 / -1.0679302, 2.1311643) + pow(x2, 0.35148922), x1 / cos(x1)), 1.4499243)
20 2.632e-02 7.120e-02 pow(-0.69117373 / pow((x1 * pow(-0.93861735 * x1, 2.3912585)) + pow(x2, 0.33060548), x1 / cos(x1)), 1.5952356)
==============================
Best equations for output 2
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 9.091e-02 -9.957e-03 0.41046748
2 9.001e-02 9.957e-03 exp(-0.81983465)
5 8.690e-02 1.172e-02 exp(-0.67575574 / cos(x1))
7 8.384e-02 1.793e-02 exp(-0.67575574 / pow(cos(x1), x1))
9 7.730e-02 4.060e-02 exp(-0.67575574 / pow(cos(x1) + x2, x1))
11 7.590e-02 9.141e-03 (exp(-0.67575574 / cos(pow(pow(x1, x1), 2.7216995))) + 0.028856449)
12 6.917e-02 9.285e-02 exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1))))
14 6.763e-02 1.128e-02 (exp(-0.67575574 / cos(pow(x1, 2.3682861 + log_abs(x1 + x1)))) + 0.028856449)
16 6.719e-02 3.281e-03 exp(-0.67575574 / cos(pow(pow(x1, 1.2391932), 2.3682861 + (log_abs(x1 + x1) + x1))))
18 5.340e-02 1.148e-01 exp(-0.6901733 / cos(pow(pow(x1, 2.6648421), pow(x1, x2) + (log_abs(x1 + x1) + x1))))
20 4.810e-02 5.223e-02 (0.067492224 + exp(-0.67770845 / cos(pow(pow(x1, 2.6648421), x1 + (log_abs(2.0 * x1) + pow(x1, x2))))))
==============================
ERROR: MethodError: <ₑ(::Symbolics.Num, ::SymbolicUtils.Term{Number, Nothing}) is ambiguous. Candidates:
<ₑ(a::Number, b::SymbolicUtils.Symbolic) in SymbolicUtils at C:\Users\arno\.julia\packages\SymbolicUtils\0KTj4\src\ordering.jl:9
<ₑ(s::Symbolics.Num, x) in Symbolics at C:\Users\arno\.julia\packages\Symbolics\LfLYY\src\num.jl:111
Possible fix, define
<ₑ(::Symbolics.Num, ::SymbolicUtils.Symbolic)
Stacktrace:
[1] (::Base.Order.var"#1#3"{typeof(SymbolicUtils.:<ₑ), typeof(identity)})(x::Symbolics.Num, y::SymbolicUtils.Term{Number, Nothing})
@ Base.Order .\ordering.jl:125
[2] lt(o::Base.Order.Lt{Base.Order.var"#1#3"{typeof(SymbolicUtils.:<ₑ), typeof(identity)}}, a::Symbolics.Num, b::SymbolicUtils.Term{Number, Nothing})
@ Base.Order .\ordering.jl:112
[3] sort!(v::Vector{Any}, lo::Int64, hi::Int64, #unused#::Base.Sort.InsertionSortAlg, o::Base.Order.Lt{Base.Order.var"#1#3"{typeof(SymbolicUtils.:<ₑ), typeof(identity)}})
@ Base.Sort .\sort.jl:507
[4] sort!(v::Vector{Any}, lo::Int64, hi::Int64, a::Base.Sort.MergeSortAlg, o::Base.Order.Lt{Base.Order.var"#1#3"{typeof(SymbolicUtils.:<ₑ), typeof(identity)}}, t::Vector{Any})
@ Base.Sort .\sort.jl:592
[5] sort!
@ .\sort.jl:591 [inlined]
[6] sort!
@ .\sort.jl:662 [inlined]
[7] #sort!#8
@ .\sort.jl:723 [inlined]
[8] arguments(a::SymbolicUtils.Add{Number, Int64, Dict{Any, Number}, Nothing})
@ SymbolicUtils C:\Users\arno\.julia\packages\SymbolicUtils\0KTj4\src\types.jl:646
[9] scalarize(arr::SymbolicUtils.Add{Number, Int64, Dict{Any, Number}, Nothing})
@ Symbolics C:\Users\arno\.julia\packages\Symbolics\LfLYY\src\arrays.jl:657
[10] iterate
@ .\generator.jl:47 [inlined]
[11] _collect(c::Vector{Any}, itr::Base.Generator{Vector{Any}, typeof(Symbolics.scalarize)}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
@ Base .\array.jl:744
[12] collect_similar(cont::Vector{Any}, itr::Base.Generator{Vector{Any}, typeof(Symbolics.scalarize)})
@ Base .\array.jl:653
[13] map(f::Function, A::Vector{Any})
@ Base .\abstractarray.jl:2849
[14] scalarize(arr::SymbolicUtils.Term{Number, Nothing})
@ Symbolics C:\Users\arno\.julia\packages\Symbolics\LfLYY\src\arrays.jl:657
[15] iterate
@ .\generator.jl:47 [inlined]
[16] collect_to!(dest::Vector{Float32}, itr::Base.Generator{Vector{Any}, typeof(Symbolics.scalarize)}, offs::Int64, st::Int64)
@ Base .\array.jl:782
[17] collect_to_with_first!(dest::Vector{Float32}, v1::Float32, itr::Base.Generator{Vector{Any}, typeof(Symbolics.scalarize)}, st::Int64)
@ Base .\array.jl:760
[18] _collect(c::Vector{Any}, itr::Base.Generator{Vector{Any}, typeof(Symbolics.scalarize)}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
@ Base .\array.jl:754
[19] collect_similar
@ .\array.jl:653 [inlined]
[20] map
@ .\abstractarray.jl:2849 [inlined]
[21] scalarize(arr::SymbolicUtils.Div{Number, Float32, SymbolicUtils.Term{Number, Nothing}, Nothing})
@ Symbolics C:\Users\arno\.julia\packages\Symbolics\LfLYY\src\arrays.jl:657
[22] iterate
@ .\generator.jl:47 [inlined]
[23] _collect(c::Vector{Any}, itr::Base.Generator{Vector{Any}, typeof(Symbolics.scalarize)}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
@ Base .\array.jl:744
[24] collect_similar(cont::Vector{Any}, itr::Base.Generator{Vector{Any}, typeof(Symbolics.scalarize)})
@ Base .\array.jl:653
[25] map(f::Function, A::Vector{Any})
@ Base .\abstractarray.jl:2849
[26] scalarize(arr::SymbolicUtils.Term{Number, Nothing})
@ Symbolics C:\Users\arno\.julia\packages\Symbolics\LfLYY\src\arrays.jl:657
[27] iterate
@ .\generator.jl:47 [inlined]
[28] _collect(c::Vector{SymbolicUtils.Symbolic{Number}}, itr::Base.Generator{Vector{SymbolicUtils.Symbolic{Number}}, typeof(Symbolics.scalarize)}, #unused#::Base.EltypeUnknown, isz::Base.HasShape{1})
@ Base .\array.jl:744
[29] collect_similar
@ .\array.jl:653 [inlined]
[30] map
@ .\abstractarray.jl:2849 [inlined]
[31] scalarize
@ C:\Users\arno\.julia\packages\Symbolics\LfLYY\src\arrays.jl:508 [inlined]
[32] Basis(eqs::Vector{SymbolicUtils.Symbolic{Number}}, states::Vector{Symbolics.Num}; parameters::Vector{Any}, iv::Symbolics.Num, controls::Vector{Any}, observed::Vector{Any}, name::Symbol, simplify::Bool, linear_independent::Bool, eval_expression::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ DataDrivenDiffEq C:\Users\arno\.julia\packages\DataDrivenDiffEq\JYq7f\src\basis\type.jl:81
[33] build_solution(prob::DataDrivenProblem{Float64, true, DataDrivenDiffEq.Direct}, alg::EQSearch, doms::Vector{Vector{PopMember}}; eval_expression::Bool)
@ DataDrivenDiffEq C:\Users\arno\.julia\packages\DataDrivenDiffEq\JYq7f\src\symbolic_regression\symbolic_regression.jl:85
[34] solve(prob::DataDrivenProblem{Float64, true, DataDrivenDiffEq.Direct}, alg::EQSearch; max_iter::Int64, weights::Nothing, numprocs::Int64, procs::Nothing, multithreading::Bool, runtests::Bool, eval_expression::Bool)
@ DataDrivenDiffEq C:\Users\arno\.julia\packages\DataDrivenDiffEq\JYq7f\src\symbolic_regression\symbolic_regression.jl:68
[35] top-level scope
@ REPL[12]:1
Also,
using DataDrivenDiffEq
using SymbolicRegression
X = rand(2,10)
Y = rand(1,10)
opts = EQSearch([+, *, /, ^, cos, exp, log], maxdepth=15, progress = true, verbosity = 1)
prob = DirectDataDrivenProblem(X, Y)
res = solve(prob, opts, numprocs = 0, multithreading = false)
julia> using DataDrivenDiffEq
julia> using SymbolicRegression
julia>
julia> X = rand(2,10)
2×10 Matrix{Float64}:
0.34475 0.906242 0.660758 0.825916 0.145821 0.903232 0.453175 0.33222 0.776786 0.491217
0.403232 0.696766 0.381359 0.621352 0.632388 0.149942 0.44397 0.780173 0.354508 0.738883
julia> Y = rand(1,10)
1×10 Matrix{Float64}:
0.786372 0.825894 0.047553 0.373386 0.688569 0.160341 0.668806 0.495233 0.441357 0.985289
julia>
julia> opts = EQSearch([+, *, /, ^, cos, exp, log], maxdepth=15, progress = true, verbosity = 1)
EQSearch(Function[+, *, /, ^, cos, exp, log], Base.Pairs{Symbol, Integer, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:maxdepth, :progress, :verbosity), Tuple{Int64, Bool, Int64}}}(:maxdepth => 15, :progress => true, :verbosity => 1))
julia> prob = DirectDataDrivenProblem(X, Y)
Direct DataDrivenProblem{Float64}
julia> res = solve(prob, opts, numprocs = 0, multithreading = false)
Started!
80.0%┣████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ ┫ 8/10 [00:37<00:11, 0.2 it/s]Head worker occupation: 88.7%
Hall of Fame:
-----------------------------------------
Complexity Loss Score Equation
1 5.396e-02 3.999e-01 x2
4 5.386e-02 6.497e-04 pow(x2, cos(0.6590349))
5 4.861e-02 1.026e-01 pow(x2, x1 / 0.6590349)
7 4.845e-02 1.694e-03 pow(x2, x1 / cos(cos(x1)))
8 4.827e-02 3.549e-03 pow(x2, pow(x1 / cos(-0.54973495), 0.5063848))
9 4.695e-02 2.788e-02 pow(x2, x1 / cos(cos(pow(x1, -2.891245))))
10 4.143e-02 1.250e-01 pow(x2, x1 / cos(cos(pow(log_abs(x1), -2.891245))))
12 2.484e-02 2.557e-01 pow(x2, x1 / cos(cos(pow(log_abs(x1), -2.1868098)) + 0.43058443))
14 2.041e-02 9.838e-02 pow(x2, x1 / pow(cos(cos(pow(log_abs(x1), -2.891245)) + x2), x2))
16 1.765e-02 7.264e-02 pow(x2, x1 / pow(cos(cos(pow(log_abs(x1), -2.891245)) + pow(x2, x1)), x2))
18 6.843e-03 4.736e-01 pow(x2, x1 / pow(cos(cos(pow(log_abs(x1), -2.891245)) + pow(x2, pow(x2, x1))), x2))
20 3.516e-03 3.329e-01 pow(x2, x1 / pow(-1.4696195 * cos(cos(pow(log_abs(x1), -2.8912997)) + pow(x2, pow(x2, x1))), x2))
ERROR: MethodError: no method matching getindex(::HallOfFame, ::Int64)
Stacktrace:
[1] (::DataDrivenDiffEq.var"#249#251"{HallOfFame, Matrix{Float64}, Matrix{Float64}, Options{Tuple{typeof(+), typeof(*), typeof(/), typeof(pow)}, Tuple{typeof(cos), typeof(exp), typeof(log_abs)}, L2DistLoss}})(i::Int64)
@ DataDrivenDiffEq C:\Users\arno\.julia\packages\DataDrivenDiffEq\JYq7f\src\symbolic_regression\symbolic_regression.jl:65
[2] iterate
@ .\generator.jl:47 [inlined]
[3] _collect
@ .\array.jl:744 [inlined]
[4] collect_similar(cont::UnitRange{Int64}, itr::Base.Generator{UnitRange{Int64}, DataDrivenDiffEq.var"#249#251"{HallOfFame, Matrix{Float64}, Matrix{Float64}, Options{Tuple{typeof(+), typeof(*), typeof(/), typeof(pow)}, Tuple{typeof(cos), typeof(exp), typeof(log_abs)}, L2DistLoss}}})
@ Base .\array.jl:653
[5] map(f::Function, A::UnitRange{Int64})
@ Base .\abstractarray.jl:2849
[6] solve(prob::DataDrivenProblem{Float64, true, DataDrivenDiffEq.Direct}, alg::EQSearch; max_iter::Int64, weights::Nothing, numprocs::Int64, procs::Nothing, multithreading::Bool, runtests::Bool, eval_expression::Bool)
@ DataDrivenDiffEq C:\Users\arno\.julia\packages\DataDrivenDiffEq\JYq7f\src\symbolic_regression\symbolic_regression.jl:64
[7] top-level scope
@ REPL[20]:1
The output of the equations is expected, but I think I'll change this in an upcoming patch . The DataDrivenSolution
just shows some error measurements of the whole result vs. the output of a print
for the AbstractBasis
( see here ). And if I am not mistaken, show
is called in the REPL, so the print
dispatch of DataDriven is not called but the `show of MTK. DataDriven vs ModelingToolkit.
Also, the error with one dimensional outputs ( size(Y) = (1,100)
or similar ) is something I've known. Either this must be dealt with in DataDriven or - which is something I would like but did not investigate - the output of SymbolicRegression
show be consistent ( so an AbstractArray
). So it's on my radar 😄 . ( see #311 for an adaptation of the result writing )
The errors on v1.7
are hard to fix for me right now, since I've switch to M1 this autumn and running the tests still give me somewhat random segfaults, especially in the SINDy methods. But maybe I'll have some workaround ( no promises here :) ) during the holidays.
I also sometimes get errors like this when running the code multiple times:
ERROR: LoadError: IOError: open("hall_of_fame.csv.out2.bkup", 769, 33206): permission denied (EACCES)
This is related to the backup file and can be passed into the Options of SymbolicRegression.
I am tagging @MilesCranmer here, since he might have some more insight on how to handle this ( and maybe thoughts on the uni- vs. multivariate results ).
Sorry for late reply, was on holidays. I don't see any of the stack trace related to SymbolicRegression.jl so not sure what the bug is coming from - maybe something related to SymbolicUtils conversion? If I run your code directly in SymbolicRegression.jl, it looks okay:
using SymbolicRegression
X = rand(2, 10)
Y = rand(2, 10)
opts = Options(binary_operators = (+, *, /, ^), unary_operators = (cos, exp, log), maxdepth = 15, progress = true, verbosity = 1)
hof = EquationSearch(X, Y, numprocs = 0, multithreading = false, options = opts)
hof
is then an array (one hall of fame for each of the two Y columns) of best equations found at each complexity, so you can get the symbolic forms like:
# First column:
dominating = calculateParetoFrontier(X, Y[1, :], hof[1], opts)
# Convert to SymbolicUtils:
eqns = [node_to_symbolic(eqn.tree, opts) for eqn in dominating]
The output is a bunch of equations in SymbolicUtils format:
5-element Vector{Any}:
0.59422123f0
pow(-0.13579363, x1)
0.9454895pow(-0.1534756, x1)
(0.7248082 + x2)*pow(-0.12237188, x1)
0.85456246(0.8123885 + x2)*pow(-0.1496819, x1)
Note that pow
here is re-defined by SymbolicRegression to pow(x, y) = abs(x)^y
.
@AlCap23 is this similar to what the current frontend is doing?
Regarding the IOError, can you raise an issue at SymbolicRegression.jl's github if you still see it when running things directly? I can't reproduce it currently.
Everything works fine when directly using SymbolicRegression.jl . All the issues are only through the use of DataDrivenDiffEq.jl .
Hi Miles! Thanks for getting involved. No worries, I have been on vacation as well.
hof
is then an array (one hall of fame for each of the two Y columns) of best equations found at each complexity, so you can get the symbolic forms like: ...
Yes, this is what is happening here. However, if size(Y) = (1, N)
hof
seems to be a singleton of the result. Am I mistaken here? This "messes" up the result recovery, which I can fix inside DataDriven or in SymbolicRegression ( dependent on your take on this @MilesCranmer).
I haven't been able to reproduce the IOError
, but will try. So far, I've never encountered a similar behaviour within DataDriven (even though I've been running several instances of the test ).
I've fixed the recovery of the results within DataDriven.
Oops, sorry for missing this! Yes, this solution looks good, nice work. Cheers, Miles
The tutorial https://datadriven.sciml.ai/stable/examples/symbolic_regression/#symbolic_regression_tutorial on 1.7 does not output the equations, it only returns: