Skip to content

Commit

Permalink
test: fix comparison in parametric function test
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Oct 6, 2024
1 parent d6ac1de commit e2b369e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/parameterized_function.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ mach = machine(model, X, y)
fit!(mach)
idx1 = lastindex(report(mach).equations)
ypred1 = predict(mach, (data=X, idx=idx1))
loss1 = sum(i -> abs(ypred1[i] - y[i]), eachindex(y))
loss1 = sum(i -> abs2(ypred1[i] - y[i]), eachindex(y))

# Should keep all parameters
stop_at[] = 1e-5
fit!(mach)
idx2 = lastindex(report(mach).equations)
ypred2 = predict(mach, (data=X, idx=idx2))
loss2 = sum(i -> abs(ypred2[i] - y[i]), eachindex(y))
loss2 = sum(i -> abs2(ypred2[i] - y[i]), eachindex(y))

# Should get better:
@test loss1 >= loss2

0 comments on commit e2b369e

Please sign in to comment.