Comments (3)
On 0.6.14 (once it uploads)
from symbolicregression.jl.
Thanks, I'm looking at this now.
I found an simpler way to reproduce it:
julia> options = SymbolicRegression.Options(
binary_operators=(+, *, /, -, ^),
unary_operators=(sqrt,),
npopulations=100,
);
julia> tree = Node(1, Node(1) ^ 1.3 + Node(2) * 3.2 ^ Node(3));
julia> printTree(tree, options)
sqrt_abs(pow(x1, 1.3) + (x2 * pow(3.2, x3)))
julia> eqn = node_to_symbolic(tree, options)
ERROR: MethodError: Cannot `convert` an object of type SymbolicUtils.Term{Number, Nothing} to an object of type SymbolicUtils.Add{Number, Int64, Dict{Any, Number}, Nothing}
Closest candidates are:
convert(::DataType, ::SymbolicUtils.Symbolic, ::Options; varMap) at /Users/mcranmer/SymbolicRegression.jl/src/InterfaceSymbolicUtils.jl:78
convert(::Type{var"#s16"} where var"#s16"<:Union{Number, T}, ::MultivariatePolynomials.AbstractPolynomialLike{T}) where T at /Users/mcranmer/.julia/packages/MultivariatePolynomials/vqcb5/src/conversion.jl:65
convert(::DataType, ::Symbol, ::Options; varMap) at /Users/mcranmer/SymbolicRegression.jl/src/InterfaceSymbolicUtils.jl:73
...
Stacktrace:
[1] sqrt_abs(x::SymbolicUtils.Add{Number, Int64, Dict{Any, Number}, Nothing})
@ SymbolicRegression.../Operators.jl ~/SymbolicRegression.jl/src/Operators.jl:74
[2] parse_tree_to_eqs(tree::Node, options::Options{Tuple{typeof(+), typeof(*), typeof(/), typeof(-), typeof(pow)}, Tuple{typeof(sqrt_abs)}, L2DistLoss}, index_functions::Bool, evaluate_functions::Bool)
@ SymbolicRegression.../InterfaceSymbolicUtils.jl ~/SymbolicRegression.jl/src/InterfaceSymbolicUtils.jl:30
[3] node_to_symbolic(tree::Node, options::Options{Tuple{typeof(+), typeof(*), typeof(/), typeof(-), typeof(pow)}, Tuple{typeof(sqrt_abs)}, L2DistLoss}; varMap::Nothing, evaluate_functions::Bool, index_functions::Bool)
@ SymbolicRegression.../InterfaceSymbolicUtils.jl ~/SymbolicRegression.jl/src/InterfaceSymbolicUtils.jl:119
[4] node_to_symbolic(tree::Node, options::Options{Tuple{typeof(+), typeof(*), typeof(/), typeof(-), typeof(pow)}, Tuple{typeof(sqrt_abs)}, L2DistLoss})
@ SymbolicRegression.../InterfaceSymbolicUtils.jl ~/SymbolicRegression.jl/src/InterfaceSymbolicUtils.jl:119
[5] top-level scope
@ REPL[17]:1
from symbolicregression.jl.
Found it!
When you call node_to_symbolic
with a custom function, you need to pass index_functions=true
. Technically sqrt
is a custom function, because it is redefined as sqrt(abs(x))
inside SymbolicRegression.jl.
I will make index_functions=true
the default to avoid this issue coming up again. It is already the default when called internally to the search, so this isn't an issue for the main loop.
from symbolicregression.jl.
Related Issues (20)
- [Feature]: Faster optimization of constants HOT 1
- SymbolicRegression.jl paper is out!
- [Feature]: can I design a custom operator for sequence data? HOT 1
- [Bug]: Threading always seems slower than multiprocessing
- [BUG]: method error when used in the debugger HOT 20
- Should use `errormonitor` on tasks for distributed mode
- [Feature]: MLJ integration HOT 3
- [Feature]: ternary operators HOT 3
- Should use scale of data when mutating or creating constants
- [BUG]: `Options` not updated in `MLJ.fit`
- Garbage collection too passive on worker processes HOT 3
- [Feature]: Including Units Evaluating Model Performance and Controlling Iterative Models Example :MLJ HOT 10
- Whether SR.jl can Implement this ARZ algorithm ? HOT 1
- Silence warnings for Optim.jl HOT 1
- Multidimensional equations HOT 4
- How do I set up a basis function consisting of three different inputs x, y, z? HOT 2
- Unique solution of Regression HOT 1
- How can I set the maximum number of nests? HOT 4
- [Feature]: Proper caching
- [Feature]: Training on high dimensions X HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symbolicregression.jl.