MilesCranmer commited on
Commit
90994b0
1 Parent(s): 913bf09

Create deprecation table for args

Browse files
Files changed (1) hide show
  1. pysr/deprecated.py +36 -0
pysr/deprecated.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Various functions to deprecate features."""
2
+
3
+ def make_deprecated_kwargs_for_pysr_regressor():
4
+ """Create dict of deprecated kwargs."""
5
+
6
+ deprecation_string = """
7
+ fractionReplaced => fraction_replaced
8
+ fractionReplacedHof => fraction_replaced_hof
9
+ npop => population_size
10
+ hofMigration => hof_migration
11
+ shouldOptimizeConstants => should_optimize_constants
12
+ weightAddNode => weight_add_node
13
+ weightDeleteNode => weight_delete_node
14
+ weightDoNothing => weight_do_nothing
15
+ weightInsertNode => weight_insert_node
16
+ weightMutateConstant => weight_mutate_constant
17
+ weightMutateOperator => weight_mutate_operator
18
+ weightRandomize => weight_randomize
19
+ weightSimplify => weight_simplify
20
+ crossoverProbability => crossover_probability
21
+ perturbationFactor => perturbation_factor
22
+ batchSize => batch_size
23
+ warmupMaxsizeBy => warmup_maxsize_by
24
+ useFrequency => use_frequency
25
+ useFrequencyInTournament => use_frequency_in_tournament
26
+ """
27
+ # Turn this into a dict:
28
+ deprecated_kwargs = {}
29
+ for line in deprecation_string.splitlines():
30
+ line = line.replace(" ", "")
31
+ if line == "":
32
+ continue
33
+ old, new = line.split("=>")
34
+ deprecated_kwargs[old] = new
35
+
36
+ return deprecated_kwargs