-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding exp() as a make_function raises overflow error #49
Comments
@trevorstephens just for your information, I found how to avoid invalid values encountered when making functions added to
It still shows a warning ( |
I have a protected
|
Closure of such a function doesn't require protection against negative numbers, it requires protection against very large numbers that could overflow if you had exp(exp(exp(x1))) for instance. |
As this has come up more than once I will reopen and add as additional documentation for how to do closure on custom functions |
def _protected_exponent(x1): |
I have run into this problem as well and looking at the solution in the above comment (thanks a lot for sharing!) I am wondering: wouldn't you want to return a really big (but finite) number rather than 0? As in:
|
@trevorstephens,
The 0.2.0 release it is perfect to make new functions as solved in issue #18.
However, I find that exponential function encounters some errors that make not achieve a result.
Looking for the following example, where we are looking for a simple exponential equation, the gplearn encounters invalid values in evaluating some functions. This makes fitness to become NaN and the algorithm seem to not converge anywhere.
This code show overflow errors creating NaN fitness as mentioned, and the final result is None
How can this issue be solved? May a solution be to avoid to check results that contain NaNs which will discard that result for fitness?
Using lower values (uniform [0,1] values) also raises the overflow
The text was updated successfully, but these errors were encountered: