Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: add warning and fix doc in gp module #3974

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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