Skip to content

Commit

Permalink
MAINT: add warning and fix doc (#3974)
Browse files Browse the repository at this point in the history
  • Loading branch information
tirthasheshpatel authored Jun 19, 2020
1 parent 3b765a5 commit 801f6d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pymc3/gp/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 801f6d2

Please sign in to comment.