mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-06-05 14:55:15 +02:00
Merge branch 'devel' of https://github.com/SheffieldML/GPy into devel
This commit is contained in:
commit
f7799ea62b
3 changed files with 16 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -5,13 +5,18 @@ import ConfigParser
|
|||
import os
|
||||
config = ConfigParser.ConfigParser()
|
||||
|
||||
user_file = os.path.join(os.getenv('HOME'),'.gpy_config.cfg')
|
||||
default_file = os.path.join('..','gpy_config.cfg')
|
||||
home = os.getenv('HOME') or os.getenv('USERPROFILE')
|
||||
user_file = os.path.join(home,'.gpy_config.cfg')
|
||||
default_file = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..', 'gpy_config.cfg'))
|
||||
print user_file, os.path.isfile(user_file)
|
||||
print default_file, os.path.isfile(default_file)
|
||||
|
||||
# 1. check if the user has a ~/.gpy_config.cfg
|
||||
if os.path.isfile(user_file):
|
||||
config.read(user_file)
|
||||
else:
|
||||
elif os.path.isfile(default_file):
|
||||
# 2. if not, use the default one
|
||||
path = os.path.dirname(__file__)
|
||||
config.read(os.path.join(path,default_file))
|
||||
config.read(default_file)
|
||||
else:
|
||||
#3. panic
|
||||
raise ValueError, "no configuration file found"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue