MilesCranmer commited on
Commit
fe186d6
1 Parent(s): df788e5

feat: add `dimensionless_constants_only` with new backend

Browse files
docs/examples.md CHANGED
@@ -520,6 +520,8 @@ a constant `"2.6353e-22[m s⁻²]"`.
520
 
521
  Note that this expression has a large dynamic range so may be difficult to find. Consider searching with a larger `niterations` if needed.
522
 
 
 
523
 
524
  ## 11. Additional features
525
 
 
520
 
521
  Note that this expression has a large dynamic range so may be difficult to find. Consider searching with a larger `niterations` if needed.
522
 
523
+ Note that you can also search for exclusively dimensionless constants by settings
524
+ `dimensionless_constants_only` to `true`.
525
 
526
  ## 11. Additional features
527
 
pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
 
5
  [project]
6
  name = "pysr"
7
- version = "0.18.3"
8
  authors = [
9
  {name = "Miles Cranmer", email = "[email protected]"},
10
  ]
 
4
 
5
  [project]
6
  name = "pysr"
7
+ version = "0.18.4"
8
  authors = [
9
  {name = "Miles Cranmer", email = "[email protected]"},
10
  ]
pysr/juliapkg.json CHANGED
@@ -3,7 +3,7 @@
3
  "packages": {
4
  "SymbolicRegression": {
5
  "uuid": "8254be44-1295-4e6a-a16d-46603ac705cb",
6
- "version": "=0.24.3"
7
  },
8
  "Serialization": {
9
  "uuid": "9e88b42a-f829-5b0c-bbe9-9e923198166b",
 
3
  "packages": {
4
  "SymbolicRegression": {
5
  "uuid": "8254be44-1295-4e6a-a16d-46603ac705cb",
6
+ "version": "=0.24.4"
7
  },
8
  "Serialization": {
9
  "uuid": "9e88b42a-f829-5b0c-bbe9-9e923198166b",
pysr/param_groupings.yml CHANGED
@@ -14,6 +14,7 @@
14
  - loss_function
15
  - model_selection
16
  - dimensional_constraint_penalty
 
17
  - Working with Complexities:
18
  - parsimony
19
  - constraints
 
14
  - loss_function
15
  - model_selection
16
  - dimensional_constraint_penalty
17
+ - dimensionless_constants_only
18
  - Working with Complexities:
19
  - parsimony
20
  - constraints
pysr/sr.py CHANGED
@@ -328,6 +328,9 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
328
  dimensional_constraint_penalty : float
329
  Additive penalty for if dimensional analysis of an expression fails.
330
  By default, this is `1000.0`.
 
 
 
331
  use_frequency : bool
332
  Whether to measure the frequency of complexities, and use that
333
  instead of parsimony to explore equation space. Will naturally
@@ -688,6 +691,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
688
  complexity_of_variables: Union[int, float] = 1,
689
  parsimony: float = 0.0032,
690
  dimensional_constraint_penalty: Optional[float] = None,
 
691
  use_frequency: bool = True,
692
  use_frequency_in_tournament: bool = True,
693
  adaptive_parsimony_scaling: float = 20.0,
@@ -783,6 +787,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
783
  self.complexity_of_variables = complexity_of_variables
784
  self.parsimony = parsimony
785
  self.dimensional_constraint_penalty = dimensional_constraint_penalty
 
786
  self.use_frequency = use_frequency
787
  self.use_frequency_in_tournament = use_frequency_in_tournament
788
  self.adaptive_parsimony_scaling = adaptive_parsimony_scaling
@@ -1654,6 +1659,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1654
  # These have the same name:
1655
  parsimony=self.parsimony,
1656
  dimensional_constraint_penalty=self.dimensional_constraint_penalty,
 
1657
  alpha=self.alpha,
1658
  maxdepth=maxdepth,
1659
  fast_cycle=self.fast_cycle,
 
328
  dimensional_constraint_penalty : float
329
  Additive penalty for if dimensional analysis of an expression fails.
330
  By default, this is `1000.0`.
331
+ dimensionless_constants_only : bool
332
+ Whether to only search for dimensionless constants, if using units.
333
+ Default is `False`.
334
  use_frequency : bool
335
  Whether to measure the frequency of complexities, and use that
336
  instead of parsimony to explore equation space. Will naturally
 
691
  complexity_of_variables: Union[int, float] = 1,
692
  parsimony: float = 0.0032,
693
  dimensional_constraint_penalty: Optional[float] = None,
694
+ dimensionless_constants_only: bool = False,
695
  use_frequency: bool = True,
696
  use_frequency_in_tournament: bool = True,
697
  adaptive_parsimony_scaling: float = 20.0,
 
787
  self.complexity_of_variables = complexity_of_variables
788
  self.parsimony = parsimony
789
  self.dimensional_constraint_penalty = dimensional_constraint_penalty
790
+ self.dimensionless_constants_only = dimensionless_constants_only
791
  self.use_frequency = use_frequency
792
  self.use_frequency_in_tournament = use_frequency_in_tournament
793
  self.adaptive_parsimony_scaling = adaptive_parsimony_scaling
 
1659
  # These have the same name:
1660
  parsimony=self.parsimony,
1661
  dimensional_constraint_penalty=self.dimensional_constraint_penalty,
1662
+ dimensionless_constants_only=self.dimensionless_constants_only,
1663
  alpha=self.alpha,
1664
  maxdepth=maxdepth,
1665
  fast_cycle=self.fast_cycle,