diff --git a/benchmarks/hyperparamopt.py b/benchmarks/hyperparamopt.py index e6f4b1cf0..f7905989a 100644 --- a/benchmarks/hyperparamopt.py +++ b/benchmarks/hyperparamopt.py @@ -149,6 +149,8 @@ def run_trial(args): weight_mutate_constant=10.0, # weight_mutate_operator=1, weight_mutate_operator=1.0, + # weight_swap_operands=1, + weight_swap_operands=1.0, # weight_randomize=1, weight_randomize=1.0, # weight_simplify=0.002, diff --git a/benchmarks/space.py b/benchmarks/space.py index 5d6a2e4eb..8099e8b23 100644 --- a/benchmarks/space.py +++ b/benchmarks/space.py @@ -53,6 +53,10 @@ weight_mutate_operator=hp.loguniform( "weight_mutate_operator", np.log(0.0001), np.log(100) ), + # weight_swap_operands=1, + weight_swap_operands=hp.loguniform( + "weight_swap_operands", np.log(0.0001), np.log(100) + ), # weight_randomize=1, weight_randomize=hp.loguniform("weight_randomize", np.log(0.0001), np.log(100)), # weight_simplify=0.002, diff --git a/pysr/deprecated.py b/pysr/deprecated.py index ecfeb45e5..5f3065e67 100644 --- a/pysr/deprecated.py +++ b/pysr/deprecated.py @@ -70,6 +70,7 @@ def make_deprecated_kwargs_for_pysr_regressor(): weightInsertNode => weight_insert_node weightMutateConstant => weight_mutate_constant weightMutateOperator => weight_mutate_operator + weightSwapOperands => weight_swap_operands weightRandomize => weight_randomize weightSimplify => weight_simplify crossoverProbability => crossover_probability diff --git a/pysr/param_groupings.yml b/pysr/param_groupings.yml index 30e9d117d..145c6b054 100644 --- a/pysr/param_groupings.yml +++ b/pysr/param_groupings.yml @@ -33,6 +33,7 @@ - weight_do_nothing - weight_mutate_constant - weight_mutate_operator + - weight_swap_operands - weight_randomize - weight_simplify - weight_optimize diff --git a/pysr/sr.py b/pysr/sr.py index 403ff25af..8bddece19 100644 --- a/pysr/sr.py +++ b/pysr/sr.py @@ -387,6 +387,9 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator): weight_mutate_operator : float Relative likelihood for mutation to swap an operator. Default is `0.47`. + weight_swap_operands : float + Relative likehood for swapping operands in binary operators. + Default is `0.0`. weight_randomize : float Relative likelihood for mutation to completely delete and then randomly generate the equation @@ -700,6 +703,7 @@ def __init__( weight_do_nothing: float = 0.21, weight_mutate_constant: float = 0.048, weight_mutate_operator: float = 0.47, + weight_swap_operands: float = 0.0, weight_randomize: float = 0.00023, weight_simplify: float = 0.0020, weight_optimize: float = 0.0, @@ -793,6 +797,7 @@ def __init__( self.weight_do_nothing = weight_do_nothing self.weight_mutate_constant = weight_mutate_constant self.weight_mutate_operator = weight_mutate_operator + self.weight_swap_operands = weight_swap_operands self.weight_randomize = weight_randomize self.weight_simplify = weight_simplify self.weight_optimize = weight_optimize @@ -1609,6 +1614,7 @@ def _run(self, X, y, mutated_params, weights, seed): mutation_weights = SymbolicRegression.MutationWeights( mutate_constant=self.weight_mutate_constant, mutate_operator=self.weight_mutate_operator, + swap_operands=self.weight_swap_operands, add_node=self.weight_add_node, insert_node=self.weight_insert_node, delete_node=self.weight_delete_node, diff --git a/pysr/version.py b/pysr/version.py index 3582caea0..d88a664ec 100644 --- a/pysr/version.py +++ b/pysr/version.py @@ -1,2 +1,2 @@ -__version__ = "0.16.8" -__symbolic_regression_jl_version__ = "0.23.0" +__version__ = "0.16.9" +__symbolic_regression_jl_version__ = "0.23.1"