-
Notifications
You must be signed in to change notification settings - Fork 32
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
Extension of #269: Use \circ
and compose
and deprecate transform
#276
Conversation
src/deprecations.jl
Outdated
@@ -0,0 +1,4 @@ | |||
@deprecate transform(k::Kernel, t::Transform) ∘(k, t) | |||
@deprecate transform(k::TransformedKernel, t::Transform) ∘(k.kernel, t ∘ k.transform) |
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.
As noted in #269, currently the transformations of TransformedKernels are chained in a weird way (IMO it's a bug). Therefore the deprecation looks a bit strange as well.
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
||
""" | ||
transform(k::Kernel, ρ::Real) | ||
Compose a `kernel` with a transformation `transform` of its inputs. |
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.
Should we repeat the mathematical definition from TransformedKernel
? Since we want users to avoid using it directly this will remove the need to navigate the docs.
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 don't like redundancy 😛 The docstring of TransformedKernel
is displayed right above this docstring, so users don't have to navigate to another page. If TransformedKernel
would not be exported anymore, one could remove its docstring and move the mathematical definition here.
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 meant to access the docs from the REPL :) I personally almost never check API pages from the docs but overuse ?
!
src/kernels/transformedkernel.jl
Outdated
|
||
""" | ||
transform(k::Kernel, ρ::AbstractVector) | ||
If no optimized implementation exists, a [`TransformedKernel`](@ref) is created. |
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.
What is meant here? Do we have any optimized implementation?
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.
That's basically copied from the docs of TransformedKernel
but I don't think there exists an optimized implementation for any transformation yet. I assumed the intention is the same as for Distributions.truncated
vs Distributions.Truncated
: the former may return arbitrary types whereas the latter is restricted to Truncated
which might not be the most efficient implementation for specific truncated distributions.
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.
Ah ok got it, so we leave it there as we might find some optimisation later?
This would also be great to add some examples for the docs of \circ. |
I can find nothing objectionable here. Happy for this to be merged once @theogf is happy :) |
For me the only problem are the docs of |
I updated the docstrings and added an example. |
This PR builds on #269 and takes it even further.
transform
is deprecated and instead\circ
and its aliasCompositionsBase.compose
are used to construct transformed kernels.Fixes #217.