From 0fa287c044af8c2bbbe9118cef66e18bf5343d64 Mon Sep 17 00:00:00 2001 From: James Hensman Date: Wed, 13 Nov 2013 12:46:59 +0000 Subject: [PATCH] allowing the passing of 1D X to a GP. with warning of course --- GPy/core/gp_base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GPy/core/gp_base.py b/GPy/core/gp_base.py index cb968520..548e2924 100644 --- a/GPy/core/gp_base.py +++ b/GPy/core/gp_base.py @@ -14,8 +14,11 @@ class GPBase(Model): Here we define some functions that are use """ def __init__(self, X, likelihood, kernel, normalize_X=False): + if len(X.shape)==1: + X = X.reshape(-1,1) + warning.warn("One dimension output (N,) being reshaped to (N,1)") self.X = X - assert len(self.X.shape) == 2 + assert len(self.X.shape) == 2, "too many dimensions for X input" self.num_data, self.input_dim = self.X.shape assert isinstance(kernel, kern.kern) self.kern = kernel