diff --git a/GPy/__init__.py b/GPy/__init__.py index 320ebc7a..47232eb8 100644 --- a/GPy/__init__.py +++ b/GPy/__init__.py @@ -4,8 +4,11 @@ import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) import os -with open("version", 'r') as f: - __version__ = f.read() + +def read(fname): + with open(os.path.join(os.path.dirname(__file__), fname)) as f: + return f.read() +__version__ = read('version') import core import models diff --git a/GPy/kern/kern.py b/GPy/kern/kern.py index 949df5ab..a6491fef 100644 --- a/GPy/kern/kern.py +++ b/GPy/kern/kern.py @@ -126,7 +126,7 @@ class kern(Parameterized): xi = patch.get_x() + patch.get_width() / 2. va = 'top' c = 'w' - t = TextPath((0, 0), "${xi}$".format(xi=xi), rotation=0, usetex=True, ha='center') + t = TextPath((0, 0), "${xi}$".format(xi=xi), rotation=0, ha='center') transform = transOffset if patch.get_extents().height <= t.get_extents().height + 3: va = 'bottom' diff --git a/GPy/util/Tango.py b/GPy/util/Tango.py index eeb2e075..06cf8368 100644 --- a/GPy/util/Tango.py +++ b/GPy/util/Tango.py @@ -2,9 +2,6 @@ # Licensed under the BSD 3-clause license (see LICENSE.txt) -import matplotlib as mpl -import pylab as pb -import sys #sys.path.append('/home/james/mlprojects/sitran_cluster/') #from switch_pylab_backend import * @@ -84,6 +81,7 @@ def reset(): lightList.append(lightList.pop(0)) def setLightFigures(): + import matplotlib as mpl mpl.rcParams['axes.edgecolor']=colorsHex['Aluminium6'] mpl.rcParams['axes.facecolor']=colorsHex['Aluminium2'] mpl.rcParams['axes.labelcolor']=colorsHex['Aluminium6'] @@ -97,6 +95,7 @@ def setLightFigures(): mpl.rcParams['ytick.color']=colorsHex['Aluminium6'] def setDarkFigures(): + import matplotlib as mpl mpl.rcParams['axes.edgecolor']=colorsHex['Aluminium2'] mpl.rcParams['axes.facecolor']=colorsHex['Aluminium6'] mpl.rcParams['axes.labelcolor']=colorsHex['Aluminium2'] @@ -157,10 +156,10 @@ cdict_Alu = {'red' :((0./5,colorsRGB['Aluminium1'][0]/256.,colorsRGB['Aluminium1 (5./5,colorsRGB['Aluminium6'][2]/256.,colorsRGB['Aluminium6'][2]/256.))} # cmap_Alu = mpl.colors.LinearSegmentedColormap('TangoAluminium',cdict_Alu,256) # cmap_BGR = mpl.colors.LinearSegmentedColormap('TangoRedBlue',cdict_BGR,256) -# cmap_RB = mpl.colors.LinearSegmentedColormap('TangoRedBlue',cdict_RB,256) if __name__=='__main__': - import pylab as pb + import matplotlib.pyplot as pb, numpy as np pb.figure() - pb.pcolor(pb.rand(10,10),cmap=cmap_RB) + cmap_RB = mpl.colors.LinearSegmentedColormap('TangoRedBlue',cdict_RB,256) + pb.pcolor(np.random.rand(10,10),cmap=cmap_RB) pb.colorbar() pb.show() diff --git a/GPy/util/plot_latent.py b/GPy/util/plot_latent.py index 207a7974..997f3df2 100644 --- a/GPy/util/plot_latent.py +++ b/GPy/util/plot_latent.py @@ -1,7 +1,7 @@ import pylab as pb import numpy as np from .. import util -from GPy.util.latent_space_visualizations.controllers.imshow_controller import ImshowController +from .latent_space_visualizations.controllers.imshow_controller import ImshowController import itertools def most_significant_input_dimensions(model, which_indices): @@ -40,15 +40,20 @@ def plot_latent(model, labels=None, which_indices=None, # first, plot the output variance as a function of the latent space Xtest, xx, yy, xmin, xmax = util.plot.x_frame2D(model.X[:, [input_1, input_2]], resolution=resolution) - Xtest_full = np.zeros((Xtest.shape[0], model.X.shape[1])) + #Xtest_full = np.zeros((Xtest.shape[0], model.X.shape[1])) def plot_function(x): + Xtest_full = np.zeros((Xtest.shape[0], model.X.shape[1])) Xtest_full[:, [input_1, input_2]] = x mu, var, low, up = model.predict(Xtest_full) var = var[:, :1] return np.log(var) + + xmi, ymi = xmin + xma, yma = xmax + view = ImshowController(ax, plot_function, - tuple(model.X[:, [input_1, input_2]].min(0)) + tuple(model.X[:, [input_1, input_2]].max(0)), + (xmi, ymi, xma, yma), resolution, aspect=aspect, interpolation='bilinear', cmap=pb.cm.binary)