Skip to content

Commit e890277

Browse files
committed
feat: weight_mutate_feature
1 parent 2d0211f commit e890277

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pysr/param_groupings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
- weight_do_nothing
4040
- weight_mutate_constant
4141
- weight_mutate_operator
42+
- weight_mutate_feature
4243
- weight_swap_operands
4344
- weight_rotate_tree
4445
- weight_randomize

pysr/sr.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,9 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
520520
weight_mutate_operator : float
521521
Relative likelihood for mutation to swap an operator.
522522
Default is `0.293`.
523+
weight_mutate_feature : float
524+
Relative likelihood for mutation to change which feature a variable node references.
525+
Default is `0.1`.
523526
weight_swap_operands : float
524527
Relative likehood for swapping operands in binary operators.
525528
Default is `0.198`.
@@ -890,6 +893,7 @@ def __init__(
890893
weight_do_nothing: float = 0.273,
891894
weight_mutate_constant: float = 0.0346,
892895
weight_mutate_operator: float = 0.293,
896+
weight_mutate_feature: float = 0.1,
893897
weight_swap_operands: float = 0.198,
894898
weight_rotate_tree: float = 4.26,
895899
weight_randomize: float = 0.000502,
@@ -1004,6 +1008,7 @@ def __init__(
10041008
self.weight_do_nothing = weight_do_nothing
10051009
self.weight_mutate_constant = weight_mutate_constant
10061010
self.weight_mutate_operator = weight_mutate_operator
1011+
self.weight_mutate_feature = weight_mutate_feature
10071012
self.weight_swap_operands = weight_swap_operands
10081013
self.weight_rotate_tree = weight_rotate_tree
10091014
self.weight_randomize = weight_randomize
@@ -2036,6 +2041,7 @@ def _run(
20362041
mutation_weights = SymbolicRegression.MutationWeights(
20372042
mutate_constant=self.weight_mutate_constant,
20382043
mutate_operator=self.weight_mutate_operator,
2044+
mutate_feature=self.weight_mutate_feature,
20392045
swap_operands=self.weight_swap_operands,
20402046
rotate_tree=self.weight_rotate_tree,
20412047
add_node=self.weight_add_node,

0 commit comments

Comments
 (0)