Spaces:
Sleeping
Sleeping
Igor S. Gerasimov
commited on
Commit
•
79398c3
1
Parent(s):
86f4103
Wrap swap operands for binary ops
Browse files- benchmarks/hyperparamopt.py +2 -0
- benchmarks/space.py +4 -0
- pysr/deprecated.py +1 -0
- pysr/param_groupings.yml +1 -0
- pysr/sr.py +6 -0
benchmarks/hyperparamopt.py
CHANGED
@@ -149,6 +149,8 @@ init_vals = [
|
|
149 |
weight_mutate_constant=10.0,
|
150 |
# weight_mutate_operator=1,
|
151 |
weight_mutate_operator=1.0,
|
|
|
|
|
152 |
# weight_randomize=1,
|
153 |
weight_randomize=1.0,
|
154 |
# weight_simplify=0.002,
|
|
|
149 |
weight_mutate_constant=10.0,
|
150 |
# weight_mutate_operator=1,
|
151 |
weight_mutate_operator=1.0,
|
152 |
+
# weight_swap_operands=1,
|
153 |
+
weight_swap_operands=1.0,
|
154 |
# weight_randomize=1,
|
155 |
weight_randomize=1.0,
|
156 |
# weight_simplify=0.002,
|
benchmarks/space.py
CHANGED
@@ -53,6 +53,10 @@ space = dict(
|
|
53 |
weight_mutate_operator=hp.loguniform(
|
54 |
"weight_mutate_operator", np.log(0.0001), np.log(100)
|
55 |
),
|
|
|
|
|
|
|
|
|
56 |
# weight_randomize=1,
|
57 |
weight_randomize=hp.loguniform("weight_randomize", np.log(0.0001), np.log(100)),
|
58 |
# weight_simplify=0.002,
|
|
|
53 |
weight_mutate_operator=hp.loguniform(
|
54 |
"weight_mutate_operator", np.log(0.0001), np.log(100)
|
55 |
),
|
56 |
+
# weight_swap_operands=1,
|
57 |
+
weight_swap_operands=hp.loguniform(
|
58 |
+
"weight_swap_operands", np.log(0.0001), np.log(100)
|
59 |
+
),
|
60 |
# weight_randomize=1,
|
61 |
weight_randomize=hp.loguniform("weight_randomize", np.log(0.0001), np.log(100)),
|
62 |
# weight_simplify=0.002,
|
pysr/deprecated.py
CHANGED
@@ -70,6 +70,7 @@ def make_deprecated_kwargs_for_pysr_regressor():
|
|
70 |
weightInsertNode => weight_insert_node
|
71 |
weightMutateConstant => weight_mutate_constant
|
72 |
weightMutateOperator => weight_mutate_operator
|
|
|
73 |
weightRandomize => weight_randomize
|
74 |
weightSimplify => weight_simplify
|
75 |
crossoverProbability => crossover_probability
|
|
|
70 |
weightInsertNode => weight_insert_node
|
71 |
weightMutateConstant => weight_mutate_constant
|
72 |
weightMutateOperator => weight_mutate_operator
|
73 |
+
weightSwapOperands => weight_swap_operands
|
74 |
weightRandomize => weight_randomize
|
75 |
weightSimplify => weight_simplify
|
76 |
crossoverProbability => crossover_probability
|
pysr/param_groupings.yml
CHANGED
@@ -33,6 +33,7 @@
|
|
33 |
- weight_do_nothing
|
34 |
- weight_mutate_constant
|
35 |
- weight_mutate_operator
|
|
|
36 |
- weight_randomize
|
37 |
- weight_simplify
|
38 |
- weight_optimize
|
|
|
33 |
- weight_do_nothing
|
34 |
- weight_mutate_constant
|
35 |
- weight_mutate_operator
|
36 |
+
- weight_swap_operands
|
37 |
- weight_randomize
|
38 |
- weight_simplify
|
39 |
- weight_optimize
|
pysr/sr.py
CHANGED
@@ -387,6 +387,9 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
387 |
weight_mutate_operator : float
|
388 |
Relative likelihood for mutation to swap an operator.
|
389 |
Default is `0.47`.
|
|
|
|
|
|
|
390 |
weight_randomize : float
|
391 |
Relative likelihood for mutation to completely delete and then
|
392 |
randomly generate the equation
|
@@ -700,6 +703,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
700 |
weight_do_nothing: float = 0.21,
|
701 |
weight_mutate_constant: float = 0.048,
|
702 |
weight_mutate_operator: float = 0.47,
|
|
|
703 |
weight_randomize: float = 0.00023,
|
704 |
weight_simplify: float = 0.0020,
|
705 |
weight_optimize: float = 0.0,
|
@@ -793,6 +797,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
793 |
self.weight_do_nothing = weight_do_nothing
|
794 |
self.weight_mutate_constant = weight_mutate_constant
|
795 |
self.weight_mutate_operator = weight_mutate_operator
|
|
|
796 |
self.weight_randomize = weight_randomize
|
797 |
self.weight_simplify = weight_simplify
|
798 |
self.weight_optimize = weight_optimize
|
@@ -1609,6 +1614,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
1609 |
mutation_weights = SymbolicRegression.MutationWeights(
|
1610 |
mutate_constant=self.weight_mutate_constant,
|
1611 |
mutate_operator=self.weight_mutate_operator,
|
|
|
1612 |
add_node=self.weight_add_node,
|
1613 |
insert_node=self.weight_insert_node,
|
1614 |
delete_node=self.weight_delete_node,
|
|
|
387 |
weight_mutate_operator : float
|
388 |
Relative likelihood for mutation to swap an operator.
|
389 |
Default is `0.47`.
|
390 |
+
weight_swap_operands : float
|
391 |
+
Relative likehood for swapping operands in binary operators.
|
392 |
+
Default is `0.024`.
|
393 |
weight_randomize : float
|
394 |
Relative likelihood for mutation to completely delete and then
|
395 |
randomly generate the equation
|
|
|
703 |
weight_do_nothing: float = 0.21,
|
704 |
weight_mutate_constant: float = 0.048,
|
705 |
weight_mutate_operator: float = 0.47,
|
706 |
+
weight_swap_operands: float = 0.024,
|
707 |
weight_randomize: float = 0.00023,
|
708 |
weight_simplify: float = 0.0020,
|
709 |
weight_optimize: float = 0.0,
|
|
|
797 |
self.weight_do_nothing = weight_do_nothing
|
798 |
self.weight_mutate_constant = weight_mutate_constant
|
799 |
self.weight_mutate_operator = weight_mutate_operator
|
800 |
+
self.weight_swap_operands = weight_swap_operands
|
801 |
self.weight_randomize = weight_randomize
|
802 |
self.weight_simplify = weight_simplify
|
803 |
self.weight_optimize = weight_optimize
|
|
|
1614 |
mutation_weights = SymbolicRegression.MutationWeights(
|
1615 |
mutate_constant=self.weight_mutate_constant,
|
1616 |
mutate_operator=self.weight_mutate_operator,
|
1617 |
+
swap_operands=self.weight_swap_operands,
|
1618 |
add_node=self.weight_add_node,
|
1619 |
insert_node=self.weight_insert_node,
|
1620 |
delete_node=self.weight_delete_node,
|