By the way, when I started working on this PR I considered for a moment an alternative implementation with a wrapper
struct AverageLoss{L} <: Loss
loss::L
end
(al::AverageLoss)(x::AVR, y::AVR) = al.loss(x, y)/length(y)
I found this pretty neat, but it would have required some major refactoring, mostly because of the parametric dispatch on glr for _solver, _fit etc. Are all these type restrictions really needed? Or could one get rid of them, maybe with a few traits?
But I am also fine with the current implementation. Please feel free to merge whenever you feel this PR is ready.
By the way, when I started working on this PR I considered for a moment an alternative implementation with a wrapper
I found this pretty neat, but it would have required some major refactoring, mostly because of the parametric dispatch on
glr
for_solver
,_fit
etc. Are all these type restrictions really needed? Or could one get rid of them, maybe with a few traits?But I am also fine with the current implementation. Please feel free to merge whenever you feel this PR is ready.
Originally posted by @jbrea in https://github.com/JuliaAI/MLJLinearModels.jl/issues/109#issuecomment-1004035779