Apply suggestions from code review
Co-Authored-By: David Lung <lungd@users.noreply.github.com>
This commit is contained in:
parent
9dce623214
commit
8afed01345
|
@ -79,8 +79,8 @@ function huber_loss(ŷ, y,delta=1.0)
|
||||||
hub_loss+=delta*(abs_error[i]- dtype(0.5*delta))
|
hub_loss+=delta*(abs_error[i]- dtype(0.5*delta))
|
||||||
end
|
end
|
||||||
|
|
||||||
return hub_loss*1//length(y)
|
|
||||||
end
|
end
|
||||||
|
hub_loss*1//length(y)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ const ϵ = 1e-7
|
||||||
end
|
end
|
||||||
|
|
||||||
@testset "huber_loss" begin
|
@testset "huber_loss" begin
|
||||||
@test Flux.huber_loss(ŷ, y) ≈ 0.0012499999999999994
|
@test Flux.huber_loss(ŷ, y) ≈ 0.20500000000000002
|
||||||
end
|
end
|
||||||
|
|
||||||
y = [123.0,456.0,789.0]
|
y = [123.0,456.0,789.0]
|
||||||
|
|
Loading…
Reference in New Issue