Spaces:
Running
Running
Update docstring of `full_objective`
Browse files- pysr/sr.py +2 -2
pysr/sr.py
CHANGED
|
@@ -342,12 +342,12 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
|
|
| 342 |
of loss function or regularizations. The default `full_objective`
|
| 343 |
used in SymbolicRegression.jl is roughly equal to:
|
| 344 |
```julia
|
| 345 |
-
function eval_loss(tree, dataset::Dataset{T}, options)::
|
| 346 |
prediction, flag = eval_tree_array(tree, dataset.X, options)
|
| 347 |
if !flag
|
| 348 |
return T(Inf)
|
| 349 |
end
|
| 350 |
-
sum((prediction .- dataset.y) .^ 2) / dataset.n
|
| 351 |
end
|
| 352 |
```
|
| 353 |
where the example elementwise loss is mean-squared error.
|
|
|
|
| 342 |
of loss function or regularizations. The default `full_objective`
|
| 343 |
used in SymbolicRegression.jl is roughly equal to:
|
| 344 |
```julia
|
| 345 |
+
function eval_loss(tree, dataset::Dataset{T,L}, options)::L where {T,L}
|
| 346 |
prediction, flag = eval_tree_array(tree, dataset.X, options)
|
| 347 |
if !flag
|
| 348 |
return T(Inf)
|
| 349 |
end
|
| 350 |
+
return sum((prediction .- dataset.y) .^ 2) / dataset.n
|
| 351 |
end
|
| 352 |
```
|
| 353 |
where the example elementwise loss is mean-squared error.
|