Replies: 3 comments 2 replies
-
Hi @LP2006, Thanks for the post. Take a look at the tuning tips page here: https://astroautomata.com/PySR/tuning/ for some info on how you could optimize the parameters for your expression. An expression with a complexity of 50 might be difficult to get exactly, but you could try. Could you post your current PySRRegressor settings? Cheers, |
Beta Was this translation helpful? Give feedback.
-
Hello, Thank you very much for the response. model = PySRRegressor(
model_selection="best",
populations = 10,
maxsize = 60,
population_size = 60,
niterations=100,
binary_operators=["+", "*",'/','^'],
unary_operators = ['square'],
warm_start = False,
tournament_selection_n = 10,
constraints={
'add': (3, 3),
'mult': (3, 3),
'pow': (-1, 1),
'div': (5, 5)
},
use_frequency_in_tournament = True,
warmup_maxsize_by = 0.2,
use_frequency = False,
nested_constraints = {
'+': {'+': 0, '*': 2, '^': 0, '/': 0},
'*': {'+': 2, '*': 2, '^': 0, '/': 0},
'^': {'+': 0, '*': 0, '^': 0, '/': 0},
'/': {'+': 2, '*': 3, '^': 0, '/': 0}
},
]
denoise = True,
select_k_features=5,
loss="loss(x, y) = (x - y)^2",
verbosity = 1e5,
progress = True,
output_torch_format = True,
random_state = 17,
procs = 0,
multithreading = False,
deterministic = True,
) Please let me know if the above settings are good to work with or if any improvements could be made. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Comments:
constraints={
'add': (3, 3),
'mult': (3, 3),
'pow': (-1, 1),
'div': (5, 5)
}, this says that "add" can only have maximum of 3 complexity in its left and right arguments. Which rules out the equation you wish to find. I would instead do: constraints={
'square': 1
}, which only imposes a constraint on
nested_constraints = {
'/': {'/': 2}
}, which means that it can only nest up to three
So in total, I would make the changes: model = PySRRegressor(
maxsize=60,
population_size=60,
niterations=1_000_000_000, # Just make this very large and exit when satisfied
binary_operators=["+", "-", "*", "/"], # Adjusted
unary_operators=["square"], # Adjusted
constraints={"square": 1}, # Adjusted
nested_constraints={"/": {"/": 2}}, # Adjusted
loss="loss(x, y) = (x - y)^2",
) I removed some of the other parameters because they are already set as defaults. No need to change them unless you know you need to. You could also play around with the Hope this helps! Miles |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am new to PySR and currently working on the following problem.
I am trying to derive the following empirical formula using PySR as part of my thesis work. The formula, upon simplification, has a complexity of around 50 (53) and contains many terms (5 input variables and combinations of them).
I already made many changes to the model including setting deterministic to True, maxsize, niterations, nested_constraints to derive the exact expression but have yet to achieve it.
The expression on expanding looks like this and the output expression from PySR should be similar to this.
I have gas (CO2, CO, NO, O2 and HC ) measurements as input data and Lambda values for output.
Could anyone help me in understanding on how to provide constraints such as constraints, nested_constraints so that they match the above expression and help the model narrow the search to the exact expression.
I have already referred to the PySR regressor reference page to understand how the above mentioned constraints work.
Any response would be highly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions