Repository navigation
ENH: Emit warning in GLM if link does not respect family domain (#2208) - #2212
Conversation
There was a problem hiding this comment.
I think this would be easier to maintain if it is in the family where currently the allowed links are defined.
eg. split
domain_safe_links = [...]
links = domain_safe_links + [L.log, L.identity]
or similar
for example Binomial is missing cloglog, and when we add loglog then it only has to be added at one point to the family.
|
I'm just thinking about weird/unusual cases, which are currently not allowed link could define a strict subset of the domain: e.g. Poisson with logit link which would bound the poisson intensity/expected value to (0, 1) which is inside the Poisson domain (0, +inf). current warning is general enough that it can be just interpreted as a domain mismatch. edit: It not really so weird. IIRC, I've seen an article with a custom link for Poisson that used Logit with multiplicative exposure as approximation to Binomial with counts. |
17d07f3 to
0449bce
Compare
There was a problem hiding this comment.
you can define safe_links = links i.e. as copy of links (so it's defined for all our families)
I think using a list is better than using a tuple so we or users can monkey patch it if necessary.
family.safe_links.append(mylink)
There was a problem hiding this comment.
Sounds good. I used a tuple because isinstance requires a tuple not a list. But I can convert the list to a tuple in the isinstance call.
Also added the checks to GEE.
There was a problem hiding this comment.
ok, I checked: cloglog is a subclass of Logit so should be covered.
maybe a comment in the code as a reminder: something like # other safe links are subclasses
|
looks good, essentially ready to merge can you squash the commits with rebase -i? Ralph just wrote some instructions in a scipy PR |
Change method of instance comparison Moved safe_links to be class variable CDFLink is safe for binomial Change tuple to list; add link-checking to GEE Add comment re subclass links
0c3194f to
3b99b60
Compare
|
Thanks, rebased and squashed. |
|
Thanks Kerby, rebase looks good I'll merge after TravisCI reports back. |
ENH: Emit warning in GLM if link does not respect family domain (#2208)
Partially (fully?) addresses #2208.
If we go ahead with this, we should add it to GEE too before merging.