Updated Msle loss

This commit is contained in:
Adarsh Kumar 2020-02-27 16:26:17 +05:30 committed by GitHub
parent 3d8965230f
commit 9dce623214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 10 deletions

View File

@ -17,33 +17,28 @@ mse(ŷ, y) = sum((ŷ .- y).^2) * 1 // length(y)
"""
mean_squared_logarithmic_error(, y;ϵ1=eps.(Float64.()),ϵ2=eps.(Float64.(y)))
msle(, y;ϵ1=eps.(Float64.()),ϵ2=eps.(Float64.(y)))
L2 loss function. Returns the mean of the squared logarithmic errors of prediction , and true values y. The ϵ1 and ϵ2 terms provide numerical stability.
Mean Squared Logarithmic Error,an L2 loss function. Returns the mean of the squared logarithmic errors of prediction , and true values y. The ϵ1 and ϵ2 terms provide numerical stability.
(Computes mean of squared(log(predicted values)-log(true value)). This error penalizes an under-predicted estimate greater than an over-predicted estimate.
```julia
julia> y_=[14726,327378,74734]
julia> y=[14726,327378,74734]
3-element Array{Int64,1}:
14726
327378
74734
julia> y = [12466.1,16353.95,16367.98]
julia> ŷ = [12466.1,16353.95,16367.98]
3-element Array{Float64,1}:
12466.1
16353.95
16367.98
julia> mean_squared_logarithmic_error(y,y_)
julia> msle(ŷ,y)
3.771271382334686
```
Alias:
msle(,y;ϵ1=eps.(Float64.()),ϵ2=eps.(Float64.(y)))
"""
mean_squared_logarithmic_error(, y;ϵ1=eps.(),ϵ2=eps.(eltype().(y))) = sum((log.(+ϵ1).-log.(y+ϵ2)).^2) * 1 // length(y)
#Alias
msle(, y;ϵ1=eps.(),ϵ2=eps.(eltype().(y))) = sum((log.(+ϵ1).-log.(y+ϵ2)).^2) * 1 // length(y)