input_sensitivity right way

This commit is contained in:
Max Zwiessele 2013-08-02 12:18:43 +01:00
parent 504ffd0cf9
commit ede5654e3c
2 changed files with 5 additions and 4 deletions

View file

@ -483,11 +483,11 @@ class Model(Parameterized):
k = k[0] k = k[0]
if k.name == 'rbf': if k.name == 'rbf':
return k.lengthscale return 1. / k.lengthscale
elif k.name == 'rbf_inv': elif k.name == 'rbf_inv':
return 1. / k.inv_lengthscale return k.inv_lengthscale
elif k.name == 'linear': elif k.name == 'linear':
return 1. / k.variances return k.variances
def pseudo_EM(self, epsilon=.1, **kwargs): def pseudo_EM(self, epsilon=.1, **kwargs):

View file

@ -13,7 +13,7 @@ def most_significant_input_dimensions(model, which_indices):
input_1, input_2 = 0, 1 input_1, input_2 = 0, 1
else: else:
try: try:
input_1, input_2 = np.argsort(model.input_sensitivity())[:2] input_1, input_2 = np.argsort(model.input_sensitivity())[::-1][:2]
except: except:
raise ValueError, "cannot Atomatically determine which dimensions to plot, please pass 'which_indices'" raise ValueError, "cannot Atomatically determine which dimensions to plot, please pass 'which_indices'"
else: else:
@ -41,6 +41,7 @@ def plot_latent(model, labels=None, which_indices=None,
# first, plot the output variance as a function of the latent space # 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, 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): def plot_function(x):
Xtest_full[:, [input_1, input_2]] = x Xtest_full[:, [input_1, input_2]] = x
mu, var, low, up = model.predict(Xtest_full) mu, var, low, up = model.predict(Xtest_full)