2012-11-29 16:39:20 +00:00
|
|
|
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
|
|
|
|
|
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
2013-06-05 17:15:26 +01:00
|
|
|
import warnings
|
|
|
|
|
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
2012-11-29 16:39:20 +00:00
|
|
|
|
2015-02-26 07:10:10 +00:00
|
|
|
from . import core
|
|
|
|
|
from . import models
|
|
|
|
|
from . import mappings
|
|
|
|
|
from . import inference
|
|
|
|
|
from . import util
|
|
|
|
|
from . import examples
|
|
|
|
|
from . import likelihoods
|
|
|
|
|
from . import testing
|
|
|
|
|
from . import kern
|
|
|
|
|
from . import plotting
|
2013-03-11 12:33:03 +00:00
|
|
|
|
2016-08-17 14:51:29 +01:00
|
|
|
from .util import normalizer
|
|
|
|
|
|
2015-11-05 09:27:59 +00:00
|
|
|
# backwards compatibility
|
|
|
|
|
import sys
|
2017-10-02 09:35:55 +01:00
|
|
|
backwards_compatibility = ['lists_and_dicts', 'observable_array', 'index_operations']
|
2015-11-05 09:27:59 +00:00
|
|
|
for bc in backwards_compatibility:
|
|
|
|
|
sys.modules['GPy.core.parameterization.{!s}'.format(bc)] = getattr(core.parameterization, bc)
|
|
|
|
|
|
2014-09-07 15:42:03 +01:00
|
|
|
# Direct imports for convenience:
|
2015-02-26 07:10:10 +00:00
|
|
|
from .core import Model
|
2015-11-05 09:27:59 +00:00
|
|
|
from .core.parameterization import priors
|
2015-11-06 09:44:26 +00:00
|
|
|
from .core.parameterization import Param, Parameterized, ObsAr, transformations as constraints
|
2014-09-07 15:42:03 +01:00
|
|
|
|
2015-09-09 09:45:01 +01:00
|
|
|
from .__version__ import __version__
|
2015-09-09 08:58:01 +01:00
|
|
|
|
2015-10-15 14:59:57 +01:00
|
|
|
from numpy.testing import Tester
|
2016-03-31 14:06:23 +01:00
|
|
|
|
|
|
|
|
with warnings.catch_warnings():
|
|
|
|
|
warnings.simplefilter('ignore')
|
|
|
|
|
try:
|
|
|
|
|
#Get rid of nose dependency by only ignoring if you have nose installed
|
|
|
|
|
from nose.tools import nottest
|
|
|
|
|
@nottest
|
|
|
|
|
def tests(verbose=10):
|
|
|
|
|
Tester(testing).test(verbose=verbose)
|
|
|
|
|
except:
|
|
|
|
|
def tests(verbose=10):
|
|
|
|
|
Tester(testing).test(verbose=verbose)
|
2014-10-29 08:22:11 +00:00
|
|
|
|
2015-09-30 14:43:04 +01:00
|
|
|
def load(file_or_path):
|
2014-10-29 08:22:11 +00:00
|
|
|
"""
|
|
|
|
|
Load a previously pickled model, using `m.pickle('path/to/file.pickle)'
|
|
|
|
|
|
|
|
|
|
:param file_name: path/to/file.pickle
|
|
|
|
|
"""
|
2015-10-16 15:22:34 +01:00
|
|
|
# This is the pickling pain when changing _src -> src
|
2015-11-09 09:22:36 +00:00
|
|
|
import sys
|
|
|
|
|
import inspect
|
|
|
|
|
sys.modules['GPy.kern._src'] = kern.src
|
|
|
|
|
for name, module in inspect.getmembers(kern.src):
|
|
|
|
|
if not name.startswith('_'):
|
|
|
|
|
sys.modules['GPy.kern._src.{}'.format(name)] = module
|
2015-11-09 13:27:24 +00:00
|
|
|
sys.modules['GPy.inference.optimization'] = inference.optimization
|
2015-11-09 10:09:07 +00:00
|
|
|
import paramz
|
2015-11-09 13:28:59 +00:00
|
|
|
return paramz.load(file_or_path)
|