|
74 | 74 | "import optax # https://github.com/deepmind/optax\n",
|
75 | 75 | "import pysr # https://github.com/MilesCranmer/PySR\n",
|
76 | 76 | "import sympy\n",
|
77 |
| - "import sympy2jax # https://github.com/google/sympy2jax\n", |
78 |
| - "\n", |
79 |
| - "\n", |
80 |
| - "# Note that PySR, which we use for symbolic regression, uses Julia as a backend.\n", |
81 |
| - "# You'll need to install a recent version of Julia if you don't have one.\n", |
82 |
| - "# (And can get funny errors if you have a too-old version of Julia already.)\n", |
83 |
| - "# You may also need to restart Python after running `pysr.install()` the first time.\n", |
84 |
| - "pysr.install(quiet=True)" |
| 77 | + "import sympy2jax # https://github.com/google/sympy2jax" |
85 | 78 | ]
|
86 | 79 | },
|
87 | 80 | {
|
|
112 | 105 | "def quantise(expr, quantise_to):\n",
|
113 | 106 | " if isinstance(expr, sympy.Float):\n",
|
114 | 107 | " return expr.func(round(float(expr) / quantise_to) * quantise_to)\n",
|
115 |
| - " elif isinstance(expr, sympy.Symbol):\n", |
| 108 | + " elif isinstance(expr, (sympy.Symbol, sympy.Integer)):\n", |
116 | 109 | " return expr\n",
|
117 | 110 | " else:\n",
|
118 | 111 | " return expr.func(*[quantise(arg, quantise_to) for arg in expr.args])"
|
|
174 | 167 | " with tempfile.TemporaryDirectory() as tempdir:\n",
|
175 | 168 | " symbolic_regressor = pysr.PySRRegressor(\n",
|
176 | 169 | " niterations=symbolic_migration_steps,\n",
|
177 |
| - " ncyclesperiteration=symbolic_mutation_steps,\n", |
| 170 | + " ncycles_per_iteration=symbolic_mutation_steps,\n", |
178 | 171 | " populations=symbolic_num_populations,\n",
|
179 | 172 | " population_size=symbolic_population_size,\n",
|
180 | 173 | " optimizer_iterations=symbolic_descent_steps,\n",
|
|
0 commit comments