EmuKit/emukit

Doc-string fix: GPyModelWrapper.get_covariance_between_points() inputs not restricted to 1 point only

BrunoKM opened this issue · 1 comments

def get_covariance_between_points(self, X1: np.ndarray, X2: np.ndarray) -> np.ndarray:
"""
Calculate posterior covariance between two points
:param X1: An array of shape 1 x n_dimensions that contains a data single point. It is the first argument of the
posterior covariance function
:param X2: An array of shape n_points x n_dimensions that may contain multiple data points. This is the second
argument to the posterior covariance function.
:return: An array of shape n_points x 1 of posterior covariances between X1 and X2
"""
return self.model.posterior_covariance_between_points(X1, X2, include_likelihood=False)

In the above, the documentation for input X1 says:

An array of shape 1 x n_dimensions that contains a data single point...

Whereas the documentation for GPys posterior_covariance_between_points() that this method wraps around says:

:param X1: some input observations
:param X2: other input observations

You can try passing more than one data point to get_covariance_between_points() at a time and it runs just fine, producing the same output (up to numerical precision) as if the data points were passed one by one.

Does that mean the docs can be expanded to say that X1 is an array of shape n_points x n_dimensions?

Yes, that's correct, and there are cases when we pass in more than one point. Good catch, and thanks for fixing it