mlr3proba to handle.
@fkiraly
but in many cases the MLE is very explicit
Yes but I don't necessarily think having a sub-standard more numerical version is a huge problem in distr6 as long as we clearly point to mlr3proba. We don't need dispatch as we can always call $pdf(log = TRUE) however I do think adding an analytical logpdf to ExoticStatistics is overdue.
@hyiltiz
As a user, having MLE in distr6 makes a huge difference
This is useful to hear thanks :)
thx Sir. Knuth
Out of interest what specific reference/quote is this to?
Sir. Knuth
No idea - Donald Knuth's algorithmics books perhaps?
Out of interest what specific reference/quote is this to?
https://wiki.c2.com/?PrematureOptimization
Premature optimization is the root of all evil.
log(p) = -Inf, for p = 0. Do you both think this is a good or bad idea? Yours answers will make a very big difference in the distr6 implementation. Because if you think it is a bad idea, then we cannot use base R log = TRUE, and all distributions will need a custom-written logPdf. If you think it's a good idea then we either need to scrap the distr6 work around of calling log on pdf when log = TRUE and just call log = TRUE if the internal function allows it, and otherwise return error.
Just to confirm something quickly, base R deals with this case by returning log(p) = -Inf, for p = 0. Do you both think this is a good or bad idea?
I think it is a good idea since it is correct.
logPdf which is either in all distributions or added in CoreStatistics, 2. use CoreStatistics decorator to replace pdf when possible with a function that includes analytical log expression. 3. change default behaviour of log = TRUE so that instead of it calling the pdf and wrapping this in log() it instead calls an analytical expression first if provided, this can be quite a quick search using a private flag, .log = logical(1)
Just to confirm something quickly, base R deals with this case by returning
log(p) = -Inf, for p = 0. Do you both think this is a good or bad idea?
Personally, I think it is a very good idea as it is the (mathematically) correct one.
Empirically speaking, for a single sample for which p=0, I'd expect log(p) to go -inf without losing much predictive power anyway; it becomes truly bad when such a single sample breaks down the whole estimation process with more samples most of which aren't edge cases. The need to "fix" comes from an empirical perspective when estimating parameters/selecting models, so probably need only to fix it empirically, rather than changing the fundamentals.
eps argument for handling edge-cases but the default will be to ignore this. We can handle this better in mlr3proba but this is outside the remit of distr6