-
Notifications
You must be signed in to change notification settings - Fork 230
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
[BUG] ERROR: LoadError: TaskFailedException, when unary_operators is changed in the example in the readme #79
Comments
For reference, including only one of the unary_operators also causes the errors. import numpy as np
from pysr import pysr, best
# Dataset
X = 2 * np.random.randn(100, 5)
y = 2 * np.cos(X[:, 3]) + X[:, 0] ** 2 - 2
# Learn equations
equations = pysr(
X,
y,
niterations=5,
binary_operators=["+", "*"],
unary_operators=[
"inv(x) = 1/x" # Define your own operator! (Julia syntax)
],
)
...# (you can use ctl-c to exit early)
print(best(equations)) This finishes with an IOError:
When I change niterations=10:
At first I thought this might be related to it running out of equations to try, but my example has 9 symbols and a result, so there should be a lot of combinations to try, yet it fails fairly quickly like the above. |
Let me try to reproduce... The actual errors here are just the processes crashing, but you should be able to see the actually useful stacktrace if you set |
Successfully reproduced your error. Thanks for the bug report! This error is strange, since I actually have a unit test for these, which passes: Line 82 in 1998ae8
|
So, when I turn on |
I should make Also see #80 - which might prevent any problems with dependencies breaking things (not sure this is the reason; but I think it's a good thing to do anyways!). |
When using multithreading=true and populations=16 it only uses 30% of my CPU? Is that expected. (I'm not using much data, maybe that's why?) |
Do you have procs equal to the number of your cores? For me it gives about ~350% when I set procs=4, with the same dataset |
Ah. Thought it automatically set that, so I didn't consider it. 8 cores uses 56% and 16 since I have hyperthreading uses 100%. I set populations=32 and it's running fine. Thanks. Might be something to look into for automatically setting that. In Julia it's Sys.CPU_THREADS to get the number of logical threads. |
Cool! Actually if you want threads set automatically, you should be able to write I also haven't tested this, but I just looked through the code and I think it will work. If not, you could do |
Describe the bug
When I run PySR with a program with no unary_operators set it produces an error and seems to produce a lot of stack traces.
Version (please complete the following information):
Configuration
The example in the README with unary_operators set to empty:
Error message
Additional context
I saw this on my own problem, but noticed it reproduces even on this minimal example.
The text was updated successfully, but these errors were encountered: