From e2b369ea768ae93d12602adbbbdf29e4bba37d66 Mon Sep 17 00:00:00 2001 From: MilesCranmer Date: Sun, 6 Oct 2024 20:14:50 +0100 Subject: [PATCH] test: fix comparison in parametric function test --- examples/parameterized_function.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/parameterized_function.jl b/examples/parameterized_function.jl index 44e9015b3..9faefc97c 100644 --- a/examples/parameterized_function.jl +++ b/examples/parameterized_function.jl @@ -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