Abandon `AbstractLink` type
All that I need to specify a likelihood is the mapping from f to a distribution, and in many cases the only degree of freedom is the inverse link function: it would be super convenient if I could just write PoissonLikelihood(log1pexp) to try out a softplus invlink, without having to code up a subtype of AbstractLink and having to remember what I have to do to implement it.
We could still dispatch analytic implementations of expected_loglik etc on typeof(exp) etc, right?
How about creating a GenericLink and have
convert(::Type{AbstractLink}, x::Any) = GenericLink(x)
?
Just so I understand better, what do we gain from defining e.g. ExpLink explicitly (rather than "only" having GenericLink(exp))?
We are able to tell what the corresponding inverse Link is LogLink
An alternative would be to add an API like
inverse_link(::typeof(exp)) = log
inverse_link(::typeof(log)) = exp
inverse_link(::typeof(log1pexp)) = logexpm1
inverse_link(::typeof(logexpm1)) = log1pexp
that would allow us to define
Base.inv(l::GenericLink) = GenericLink(inverse_link(l.f))