Added Gauss-Legendre Quadrature Fourier features#64
Conversation
vdutor
left a comment
There was a problem hiding this comment.
Nice PR - the code structure makes a lot of sense. I believe two things are missing right now:
- a README in the
fourier_featuresdirectory outlining the different methods and in which scenarios they can be used. This can be very brief as long as it is practical. We could use tables or diagrams for this. - It looks like there are no tests for a few of the GaussianQuadrature features?
| warnings.warn( | ||
| "Quadrature Fourier feature approximation of kernels " | ||
| "with small lengthscale lead to unexpected behaviors!" | ||
| "Fourier feature approximation of kernels with small " |
There was a problem hiding this comment.
Please add what you mean by "small".
| class QuadratureFourierFeatures(GaussHermiteQuadratureFourierFeatures): | ||
| """ | ||
| Alias for `GaussHermiteQuadratureFourierFeatures`. | ||
| """ | ||
|
|
||
| pass |
There was a problem hiding this comment.
| class QuadratureFourierFeatures(GaussHermiteQuadratureFourierFeatures): | |
| """ | |
| Alias for `GaussHermiteQuadratureFourierFeatures`. | |
| """ | |
| pass | |
| QuadratureFourierFeatures = GaussHermiteQuadratureFourierFeatures | |
| """ Alias for `GaussHermiteQuadratureFourierFeatures` """ |
There was a problem hiding this comment.
Maybe explain why we have this alias in place? Is this the most common and recommended quadrature rule?
| super(FourierFeaturesBase, self).__init__(**kwargs) | ||
| assert isinstance( | ||
| kernel, self.SUPPORTED_KERNELS | ||
| ), f"Only the following kernels are supported: {self.SUPPORTED_KERNELS}" |
There was a problem hiding this comment.
Minor: You could make this message more informative by specifying which kernel the user used.
|
|
||
| def _compute_bases(self, inputs: TensorType) -> tf.Tensor: | ||
| """ | ||
| Compute basis functions. |
There was a problem hiding this comment.
Minor: the word "compute" made me first think the function would return a functor with the basis functions.
| Compute basis functions. | |
| Evaluate the 2L^D number of basis functions at `inputs`. |
| from gpflux.types import ShapeType | ||
|
|
||
|
|
||
| class QuadratureFourierFeaturesBase(FourierFeaturesBase): |
There was a problem hiding this comment.
Please give a type and short description of self.factors as it is being used in _compute_constant.
| class QuadratureFourierFeaturesBase(FourierFeaturesBase): | |
| class QuadratureFourierFeaturesBase(FourierFeaturesBase): | |
| factors: Type | |
| """Description""" |
|
|
||
|
|
||
| class QuadratureFourierFeatures(FourierFeaturesBase): | ||
| class GaussianQuadratureFourierFeatures(QuadratureFourierFeaturesBase): |
There was a problem hiding this comment.
| class GaussianQuadratureFourierFeatures(QuadratureFourierFeaturesBase): | |
| class GaussianQuadratureFourierFeatures(QuadratureFourierFeaturesBase): | |
| """ Base class for `GaussHermiteQuadratureFourierFeatures` and `GaussLegendreQuadratureFourierFeatures`. |
| super(QuadratureFourierFeatures, self).__init__(kernel, n_components, **kwargs) | ||
|
|
||
|
|
||
| class GaussHermiteQuadratureFourierFeatures(GaussianQuadratureFourierFeatures): |
There was a problem hiding this comment.
Is it possible to add a reference to which maths this class implements?
| def _compute_bases(self, inputs: TensorType) -> tf.Tensor: | ||
| """ | ||
| Compute basis functions. | ||
| class GaussLegendreQuadratureFourierFeatures(GaussianQuadratureFourierFeatures): |
There was a problem hiding this comment.
Is it possible to add a reference to which maths this class implements?
| from gpflux.types import ShapeType | ||
|
|
||
|
|
||
| class SimpsonQuadratureFourierFeatures(QuadratureFourierFeaturesBase): |
There was a problem hiding this comment.
Is it possible to add a reference to which maths this class implements?
|
|
||
|
|
||
| class QuasiRandomFourierFeatures(RandomFourierFeatures): | ||
|
|
No description provided.