Open dbl001 opened 1 year ago
I like that idea! Feel free to make a PR. Maybe something of the following form?
model = PySRRegressor(
complexity_of_constants=100 # to prevent PySR finding scalars
)
model.fit(X, y, constants={"pi": 3.14, "one": 1, "two": 2})
If not I could eventually work on this but might take some time.
I think when passing constants
like this, they would basically be added as additional columns to the input data X
. Previously you would have to manually add columns to X
with the constant value and set the variable_names
.
I experimented with PySR on Feynman equation 76 (e.g. qv/(2pi*r)) to see if it could 'learn' the constant 'Pi'? With the full data file but only 1,000 rows PySR generated:
With the feynman_problem.py interface:
I know I can add the number Pi as an additional column to the input data file. Do you think there would be any advantage(s) do allowing constants to be specified in the PySRRegressor?