Skip to content

Conversation

@ltiao
Copy link
Collaborator

@ltiao ltiao commented Dec 15, 2021

No description provided.

Copy link
Collaborator

@vdutor vdutor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR - the code structure makes a lot of sense. I believe two things are missing right now:

  1. a README in the fourier_features directory 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.
  2. 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 "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add what you mean by "small".

Comment on lines +126 to +131
class QuadratureFourierFeatures(GaussHermiteQuadratureFourierFeatures):
"""
Alias for `GaussHermiteQuadratureFourierFeatures`.
"""

pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class QuadratureFourierFeatures(GaussHermiteQuadratureFourierFeatures):
"""
Alias for `GaussHermiteQuadratureFourierFeatures`.
"""
pass
QuadratureFourierFeatures = GaussHermiteQuadratureFourierFeatures
""" Alias for `GaussHermiteQuadratureFourierFeatures` """

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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}"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: the word "compute" made me first think the function would return a functor with the basis functions.

Suggested change
Compute basis functions.
Evaluate the 2L^D number of basis functions at `inputs`.

from gpflux.types import ShapeType


class QuadratureFourierFeaturesBase(FourierFeaturesBase):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please give a type and short description of self.factors as it is being used in _compute_constant.

Suggested change
class QuadratureFourierFeaturesBase(FourierFeaturesBase):
class QuadratureFourierFeaturesBase(FourierFeaturesBase):
factors: Type
"""Description"""



class QuadratureFourierFeatures(FourierFeaturesBase):
class GaussianQuadratureFourierFeatures(QuadratureFourierFeaturesBase):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class GaussianQuadratureFourierFeatures(QuadratureFourierFeaturesBase):
class GaussianQuadratureFourierFeatures(QuadratureFourierFeaturesBase):
""" Base class for `GaussHermiteQuadratureFourierFeatures` and `GaussLegendreQuadratureFourierFeatures`.

super(QuadratureFourierFeatures, self).__init__(kernel, n_components, **kwargs)


class GaussHermiteQuadratureFourierFeatures(GaussianQuadratureFourierFeatures):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add a reference to which maths this class implements?

from gpflux.types import ShapeType


class SimpsonQuadratureFourierFeatures(QuadratureFourierFeaturesBase):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add a reference to which maths this class implements?



class QuasiRandomFourierFeatures(RandomFourierFeatures):

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

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.

3 participants