From 801f6d2e77772f0624121750d08aa3214d76b0d1 Mon Sep 17 00:00:00 2001 From: Tirth Patel Date: Fri, 19 Jun 2020 16:17:45 +0530 Subject: [PATCH] MAINT: add warning and fix doc (#3974) --- pymc3/gp/cov.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pymc3/gp/cov.py b/pymc3/gp/cov.py index 4260564478b..6d25c9dc117 100644 --- a/pymc3/gp/cov.py +++ b/pymc3/gp/cov.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import warnings import numpy as np import theano import theano.tensor as tt @@ -85,6 +86,11 @@ def full(self, X, Xs): raise NotImplementedError def _slice(self, X, Xs): + if self.input_dim != X.shape[-1]: + warnings.warn(f"Only {self.input_dim} column(s) out of {X.shape[-1]} are" + " being used to compute the covariance function. If this" + " is not intended, increase 'input_dim' parameter to" + " the number of columns to use. Ignore otherwise.", UserWarning) X = tt.as_tensor_variable(X[:, self.active_dims]) if Xs is not None: Xs = tt.as_tensor_variable(Xs[:, self.active_dims]) @@ -467,7 +473,7 @@ class Cosine(Stationary): The Cosine kernel. .. math:: - k(x, x') = \mathrm{cos}\left( \pi \frac{||x - x'||}{ \ell^2} \right) + k(x, x') = \mathrm{cos}\left( 2 \pi \frac{||x - x'||}{ \ell^2} \right) """ def full(self, X, Xs=None):