Spaces:
				
			
			
	
			
			
					
		Running
		
	
	
	
			
			
	
	
	
	
		
		
					
		Running
		
	Commit 
							
							·
						
						cfa9a72
	
1
								Parent(s):
							
							5a01e6f
								
Clean up example in docstring
Browse files- 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 | 
         
            -
                 
     | 
| 538 | 
         
            -
                 
     | 
| 539 | 
         
            -
                 
     | 
| 540 | 
         
            -
                 
     | 
| 541 | 
         
            -
                 
     | 
| 542 | 
         
            -
                 
     | 
| 543 | 
         
            -
                 
     | 
| 544 | 
         
            -
                 
     | 
| 545 | 
         
            -
                 
     | 
| 546 | 
         
            -
                 
     | 
| 547 | 
         
            -
                 
     | 
| 548 | 
         
             
                >>> model.fit(X, y)
         
     | 
| 549 | 
         
            -
                 
     | 
| 
         | 
|
| 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
         
     |