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

dims keyword arg for `mad` ?

Open bjarthur opened this issue 3 years ago • 4 comments

is there a reason not to have it so that the interfaces matches median, mean, std, etc. ?

bjarthur avatar Oct 12 '21 20:10 bjarthur

I don't think so. I think it's partly because nobody has done the work and partly because there has been a slight trend towards using higher or functions like mapslices instead of adding more keywords.

andreasnoack avatar Oct 12 '21 20:10 andreasnoack

IIRC mapslices used to be slow. was that the case, and if so, is it still?

bjarthur avatar Oct 12 '21 20:10 bjarthur

It's been a while since I've seen any timings. It might be true but I think there are more alternatives now such as https://bramtayl.github.io/JuliennedArrays.jl/latest/ which I've heard should perform well.

andreasnoack avatar Oct 12 '21 21:10 andreasnoack

mapslices is slow as it makes copies, and it can't change until Julia 2.0. But eachslice can be used instead.

nalimilan avatar Nov 05 '21 19:11 nalimilan

If deciding to implement this instead of relying on eachslice, it would be nice to implement this for sem as well, if one is already on a roll.

yuvalwas avatar Jun 12 '23 08:06 yuvalwas

I think sem.(eachrow(x)), sem.(eachcol(x)) and sem.(eachslice(x, ...)) are the way to go now. Arguments probably won't be added because these syntaxes are short and explicit.

nalimilan avatar Jun 12 '23 12:06 nalimilan