-
Notifications
You must be signed in to change notification settings - Fork 15
Composable scalar transforms #128
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
base: master
Are you sure you want to change the base?
Conversation
I've added some scalar consistency tests now, which pass, with this new API. If there are some other obvious tests, I am open to suggestions. Still missing is any treatment of non- New questions
|
Some other ideas I had but which haven't tried out yet (note to self as much as anything else)
|
I decided to add a I haven't thought deeply about what this current implementation will do with real number types, e.g. As far as using this to introduce Unitful support, I see two main options:
In case 1, new number types each need their own extension. In case 2, inverse transforms will not yield original types. |
I think this is shaping up nicely, thanks for the work! Sorry I have been very busy with a project and failed to provide any feedback so far, I will try to make up for it now.
Chaining just multiplies the Jacobians, so abs(log(...)) Jacobians are just added up. It should be something like
I think that is OK, I think we should just clarify the API for |
I went ahead and tried out replacing the
|
I guess if we take this approach and have a |
Co-authored-by: David Widmann <[email protected]>
With respect to the |
Co-authored-by: David Widmann <[email protected]>
…rmVariables.jl into composite-scalar
That's the expected behaviour IMO, it should print |
@devmotion, thanks for the review. As for the following:
I did not benchmark, but I am OK with a minor hit in compilation time in exchange for more flexibility. Eg I want to introduce other R->R+ transforms, as exp is not always the best option.
Benchmarks above suggest it is innocuous.
It just does what those transformations did previously, only in composable steps. |
|
After trying to use this in my code base, the two things I found myself wanting were:
(although I did already add docs indicating this could be done by extending the That said, those can go into a future PR, and I'm content with this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have a cosmetic docs change, if you are OK with that please commit and I will merge. Thanks for all the great work! I especially like how Unitful
etc does not require special treatment.
Co-authored-by: Tamas K. Papp <[email protected]>
Co-authored-by: David Widmann <[email protected]>
…rmVariables.jl into composite-scalar
This is very much still WIP, but took a stab at constructing something like discussed in #95 and #126 . As of yet, I haven't even tested that this runs, much less correctly; will come back when I have more time.
One major question: for things like mapping to negative reals, I am imagining
Scale(-1) ∘ Exp()
. In this case, should the log-Jacobian ofScale
belog(abs(scale))
?