Integer constants + how to use atan2 #344
-
Hi all!
Much appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
data_cols = 5
integer_cols = 2
X = np.random.randn(100, data_cols + integer_cols) # Normal data is first 5 columns
X[:, data_cols+0] = 1
X[:, data_cols+1] = 2 We have generated some random data and then set the last two columns equal to the constants we wish for PySR to use. Then, we need to disable PySR from finding its own constants, by making them prohibitively expensive (and also disabling the constant optimization routine to speed things up): settings_to_disable_constants = dict(
complexity_of_constants=100, # Make constants too expensive to use
should_optimize_constants=False, # =speed up
weight_mutate_constant=0.0 # =speed up
)
model = PySRRegressor(**your_settings, **settings_to_disable_constants)
model.fit(X, y, variable_names=["x1", "x2", "x3", "x4", "x5", "_1", "_2"]) The equation will show Julia's Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Amazing! Thanks for the prompt reply Miles! Just wanted to say this is an amazing tech you've built! |
Beta Was this translation helpful? Give feedback.
-
Again, really appreciate your help! I can't seem to get atan2 working, I have the following: ` extra_sympy_mappings={"atan2": lambda x, y: sympy.atan(x,y)}, and am getting the error:
|
Beta Was this translation helpful? Give feedback.
-
Nvm! Got it working: binary_operators=["*", "+", "-", "/", "^", "greater", "atan2(x, y) = atan(x, y)"], |
Beta Was this translation helpful? Give feedback.
1
and2
as features. For example:We have generated some random data and then set the last two columns equal to the constants we wish for PySR to use.
Then, we need to disable PySR from finding its own constants, by making them prohibitively expensive (and also disabling the constant optimization routine to speed things up):