JuliaML / JuliaML/LossFunctions.jl
Introduce uniform interface for accessing loss function parameters
- Dominant language
- Julia
- Stars
- 153
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
Perhaps I'm missing something, but this does not appear to exist at present. For most losses with a parameter, you access using property, as in
```julia
loss = HuberLoss(0.5)
julia> loss.d
0.5
```
But for an LPDistLoss there no field for `p`, only a type parameter:
```julia
julia> loss=LPDistLoss(2.5)
LPDistLoss{2.5}()
julia> propertynames(loss)
()
```
One suggestion would be overload `Base.getproperty`/`Base.propertynames` for cases of the second kind (I think these are just `LPDistLoss`, `L1DistLoss`, `L2DistLoss`, but I haven't checked lately), or to implement `StatsBase.params` or both.
I ran into this issue when wrapping the losses for use in MLJ and was obliged to write my own [interface](https://github.com/JuliaAI/MLJBase.jl/blob/a202a689ee3272ce7541ebeeb9a006cec733c4c9/src/measures/loss_functions_interface.jl#L26), which is not robust to extensions of LossFunctions.jl
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.