-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add with_period
convenience function and a example to PeriodicTransform
docstring
#401
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #401 +/- ##
===========================================
- Coverage 89.23% 78.89% -10.34%
===========================================
Files 52 53 +1
Lines 1198 1199 +1
===========================================
- Hits 1069 946 -123
- Misses 129 253 +124
Continue to review full report at Codecov.
|
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.
One of the motivations of with_lengthscale
is that it provides a unified API for ScaleTransform
and ARDTransform
(although one can save allocations by using ARDTransform
directly). This is not the case here since it will always just add a PeriodTransform
. Usually, users are expected to use the transforms, eg there's also no with_linear
or with_function
as one can just use LinearTransform
and FunctionTransform
. Therefore maybe we should not add an additional function to the API but rather
- tell users (how) to use
PeriodTransform
directly - add a convenience constructor
PeriodKernel(r::Real)
I thought that |
My motivation for introducing
I'm not quite sure what you mean by that, and how it's different from What should the meaning of periodicity be in more than one dimension? Coordinate-wise (i.e., equivalent to a product of kernels operating on one of the dimensions each)? |
So it seems the main motivation is to introduce a different parametrization of function PeriodicTransform(; period=nothing, frequency=period === nothing ? 1.0 : inv(period))
return PeriodicTransform{typeof(frequency)}(frequency)
end I am mainly questioning if it is worth adding a new function |
Hmm, having looked at the code again, I'm wondering about what the right way for defining periodic kernels actually is. |
That was quite rambly. So in bullet points:
|
This is the main reason why I still think that PeriodicTransform should map to complex numbers with |
Then the base kernel would have to handle complex numbers, how would that affect speed e.g. when trying to run it on the GPU? It seems like it'd still be more extra effort than just computing the "equivalent distance" for the base kernel, no? |
You don't necessarily have to or want to use the |
This PR follows the suggestion in this comment
As it is
with_period
only works with scalars, which contrasts withwith_lengthscale
that usesARDTransform
to deal with vector inputs. Any ideas on how should we deal with this?