Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define inverse functions with InverseFunctions.jl #29

Merged
merged 1 commit into from
Oct 19, 2021
Merged

Conversation

devmotion
Copy link
Member

@devmotion devmotion commented Oct 15, 2021

This PR adds an implementation of InverseFunctions.inverse for log1pexp, logexpm1, log1mexp, log2mexp, logit, and logistic.

InverseFunctions is a lightweight package with no external dependencies that only defines the InverseFunctions.inverse interface and implements it for functions from base such as exp or log. In many scenarios it is useful to be able to retrieve the inverse function to a given function automatically, and InverseFunctions provides an interface for this task. In particular, it would be very useful if this would work also for log1pexp/logexpm1 and logit/logistic as then the former could be used e.g. in ParameterHandling.positive or in GPLikelihoods as a replacement for the standard exponential transformation to the positive real numbers, without any additional code or requirement in these packages. LogExpFunctions is the only place where inverse can be defined without committing type piracy.

@tpapp
Copy link
Collaborator

tpapp commented Oct 17, 2021

(I am busy now, can review this at the end of Oct)

@devmotion devmotion merged commit d0c80b7 into master Oct 19, 2021
@devmotion devmotion deleted the dw/inverse branch October 19, 2021 20:33
@oschulz
Copy link
Contributor

oschulz commented Nov 5, 2021

Sorry, I complete missed that this had been merged. I'll prep a PR to support ChangesOfVariables.with_logabsdet_jacobian for the same functions, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants