MilesCranmer commited on
Commit
cfa9a72
1 Parent(s): 5a01e6f

Clean up example in docstring

Browse files
Files changed (1) hide show
  1. pysr/sr.py +13 -12
pysr/sr.py CHANGED
@@ -534,19 +534,20 @@ class PySRRegressor(BaseEstimator, RegressorMixin, MultiOutputMixin):
534
  >>> # y = 2.5372 * cos(x_3) + x_0 - 0.5
535
  >>> y = 2.5382 * np.cos(X[:, 3]) + X[:, 0] ** 2 - 0.5
536
  >>> model = PySRRegressor(
537
- >>> niterations=40,
538
- >>> binary_operators=["+", "*"],
539
- >>> unary_operators=[
540
- >>> "cos",
541
- >>> "exp",
542
- >>> "sin",
543
- >>> "inv(x) = 1/x", # Custom operator (julia syntax)
544
- >>> ],
545
- >>> model_selection="best",
546
- >>> loss="loss(x, y) = (x - y)^2", # Custom loss function (julia syntax)
547
- >>> )
548
  >>> model.fit(X, y)
549
- PySRRegressor.equations = [0e-02 (((x0 * x0) + ((cos(x3) * inv(sin(sin(cos(0.5076455))))) * (0.79839814 + sin(inv(0.5623672))))) + -0.5378383) pick score equation loss complexity
 
550
  0 0.000000 3.8552167 3.360272e+01 1
551
  1 1.189847 (x0 * x0) 3.110905e+00 3
552
  2 0.010626 ((x0 * x0) + -0.25573406) 3.045491e+00 5
 
534
  >>> # y = 2.5372 * cos(x_3) + x_0 - 0.5
535
  >>> y = 2.5382 * np.cos(X[:, 3]) + X[:, 0] ** 2 - 0.5
536
  >>> model = PySRRegressor(
537
+ ... niterations=40,
538
+ ... binary_operators=["+", "*"],
539
+ ... unary_operators=[
540
+ ... "cos",
541
+ ... "exp",
542
+ ... "sin",
543
+ ... "inv(x) = 1/x", # Custom operator (julia syntax)
544
+ ... ],
545
+ ... model_selection="best",
546
+ ... loss="loss(x, y) = (x - y)^2", # Custom loss function (julia syntax)
547
+ ... )
548
  >>> model.fit(X, y)
549
+ >>> model
550
+ PySRRegressor.equations = [
551
  0 0.000000 3.8552167 3.360272e+01 1
552
  1 1.189847 (x0 * x0) 3.110905e+00 3
553
  2 0.010626 ((x0 * x0) + -0.25573406) 3.045491e+00 5