MilesCranmer commited on
Commit
ffc5f5c
1 Parent(s): 70b842a

Overload operators at import rather than fit

Browse files
Files changed (2) hide show
  1. pysr/julia_helpers.py +6 -0
  2. pysr/sr.py +0 -6
pysr/julia_helpers.py CHANGED
@@ -12,6 +12,12 @@ jl.seval("using PythonCall: PythonCall")
12
  Serialization = jl.Serialization
13
  PythonCall = jl.PythonCall
14
 
 
 
 
 
 
 
15
 
16
  def install(*args, **kwargs):
17
  del args, kwargs
 
12
  Serialization = jl.Serialization
13
  PythonCall = jl.PythonCall
14
 
15
+ jl.plus = jl.seval("(+)")
16
+ jl.sub = jl.seval("(-)")
17
+ jl.mult = jl.seval("(*)")
18
+ jl.pow = jl.seval("(^)")
19
+ jl.div = jl.seval("(/)")
20
+
21
 
22
  def install(*args, **kwargs):
23
  del args, kwargs
pysr/sr.py CHANGED
@@ -1560,12 +1560,6 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1560
  if cluster_manager is not None:
1561
  cluster_manager = _load_cluster_manager(cluster_manager)
1562
 
1563
- jl.plus = jl.seval("(+)")
1564
- jl.sub = jl.seval("(-)")
1565
- jl.mult = jl.seval("(*)")
1566
- jl.pow = jl.seval("(^)")
1567
- jl.div = jl.seval("(/)")
1568
-
1569
  # TODO(mcranmer): These functions should be part of this class.
1570
  binary_operators, unary_operators = _maybe_create_inline_operators(
1571
  binary_operators=binary_operators,
 
1560
  if cluster_manager is not None:
1561
  cluster_manager = _load_cluster_manager(cluster_manager)
1562
 
 
 
 
 
 
 
1563
  # TODO(mcranmer): These functions should be part of this class.
1564
  binary_operators, unary_operators = _maybe_create_inline_operators(
1565
  binary_operators=binary_operators,