LossFunctions.jl icon indicating copy to clipboard operation
LossFunctions.jl copied to clipboard

No difference between `WeightedMean` and `WeighedSum` when `normalize=false`

Open ablaom opened this issue 4 years ago • 1 comments

This looks like a bug to me:

julia> y = rand(3); yhat = rand(3); w = rand(3);

julia> value(L1DistLoss(), y, yhat, AggMode.WeightedMean(w, normalize=false))
0.4515037807304132

julia> value(L1DistLoss(), y, yhat, AggMode.WeightedSum(w, normalize=false))
0.4515037807304132

I believe the problem is with weighted mean:

julia> value(L1DistLoss(), [1, 2, 3], [2, 5, -2], AggMode.WeightedMean([1, 2, 1], normalize=false))
12.0

The unweighed distances are [1, 3, 1]. So the weighted distances are [1, 6, 1], which has mean 8/3 not 12, right?

ablaom avatar Sep 03 '21 00:09 ablaom

Definitely a bug @ablaom , sorry for only seeing this issue now. I am revamping the package for a new minor release and will try to fix this right away.

juliohm avatar May 22 '22 13:05 juliohm

@juliohm Friendly reminder.

ablaom avatar Apr 03 '23 23:04 ablaom