Forcing constants to be dimensionless #606
-
I am using the dimensional constraints in my PySR model. For context here are units of the dataset that I am testing with:
Question 1. I just would like to double check that I can set a dimensionless units with "". Question 2. When I am fitting my current model (dimensional_constraint_penalty=10**5) the units of all constants are [.]. I know that in my field, in this particular case, we would expect these constants to be dimensionless as this forces the physical meaning of the equation to come from the variables being used and their relation. I would like to put a dimensionless unit constraint on coefficients in order to force PySR to create physically meaningful relations. How should I go about doing that? Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
Correct although I might prefer using
When it says the units are The reason for this is that it's expensive to calculate exact units for every constant in an expression (and sometimes there are multiple valid solutions!). However, you can verify if an expression is dimensionally possible quite cheaply. See https://astroautomata.com/PySR/examples/#10-dimensional-constraints for info on this. |
Beta Was this translation helpful? Give feedback.
-
Edit: made MilesCranmer/SymbolicRegression.jl#307 which switches from |
Beta Was this translation helpful? Give feedback.
-
I added this feature in #608 with the I will merge this in a few days once the global registries are safely up-to-date with the new SymbolicRegression backend. In the meantime you can install it yourself with, e.g., pip install git+https://github.com/MilesCranmer/PySR.git@dimensionless-constants Edit: Is available in PySR 0.18.4. |
Beta Was this translation helpful? Give feedback.
I added this feature in #608 with the
dimensionless_constants_only
parameter (set toTrue
for your use-case).I will merge this in a few days once the global registries are safely up-to-date with the new SymbolicRegression backend.
In the meantime you can install it yourself with, e.g.,
Edit: Is available in PySR 0.18.4.