Is there a way to prevent certain combinations of operators, like exp(cos(x)) ? #69
-
|
Hello. I'd like to use this package for Symbolic Regression of physics equations. Now, physics equations rarely exhibit exponentials of sinusoids. So is there a way for me to tell PySR to not use Can this be done? If so, how may I do it? I was thinking about defining my own exponential function that cannot take sinusoids as an argument, but I am currently unsure about how to do this. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Hi @jburz2001, Great question, this is something that I think would be useful for many. You are right that you could disable complex arguments with the While I don't have a timeline for when I would be able to implement this, what I can do is point you to where this could potentially be added if you are interested. In the backend (https://github.com/MilesCranmer/SymbolicRegression.jl/), there is a function here: function check_constraints(tree::Node, options::Options, maxsize::Int)::Bool
if countNodes(tree) > maxsize
return false
end
for i=1:options.nbin
if options.bin_constraints[i] == (-1, -1)
continue
elseif flagBinOperatorComplexity(tree, Val(i), options)
return false
end
end
for i=1:options.nuna
if options.una_constraints[i] == -1
continue
elseif flagUnaOperatorComplexity(tree, Val(i), options)
return false
end
end
return true
endThis checks the user-passed constraints, and returns If interested in trying to implement this:
Let me know if you have questions! |
Beta Was this translation helpful? Give feedback.
-
|
Just following up on this. There is now the |
Beta Was this translation helpful? Give feedback.
Just following up on this. There is now the
nested_constraintsparameter, which is exactly built for this purpose.