mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-04-28 06:16:24 +02:00
fixed plotting bug
This commit is contained in:
parent
c0eddf29e7
commit
e4fcde3299
2 changed files with 11 additions and 8 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
# Licensed under the BSD 3-clause license (see LICENSE.txt)
|
||||||
|
|
||||||
import pylab as pb
|
import pylab as pb
|
||||||
|
import sys
|
||||||
#import numpy as np
|
#import numpy as np
|
||||||
#import Tango
|
#import Tango
|
||||||
#from base_plots import gpplot, x_frame1D, x_frame2D
|
#from base_plots import gpplot, x_frame1D, x_frame2D
|
||||||
|
|
|
||||||
|
|
@ -94,14 +94,7 @@ def plot_fit(model, plot_limits=None, which_data_rows='all',
|
||||||
ax.plot(Xnew, yi[:,None], Tango.colorsHex['darkBlue'], linewidth=0.25)
|
ax.plot(Xnew, yi[:,None], Tango.colorsHex['darkBlue'], linewidth=0.25)
|
||||||
#ax.plot(Xnew, yi[:,None], marker='x', linestyle='--',color=Tango.colorsHex['darkBlue']) #TODO apply this line for discrete outputs.
|
#ax.plot(Xnew, yi[:,None], marker='x', linestyle='--',color=Tango.colorsHex['darkBlue']) #TODO apply this line for discrete outputs.
|
||||||
|
|
||||||
#add inducing inputs (if a sparse model is used)
|
|
||||||
if hasattr(model,"Z"):
|
|
||||||
#Zu = model.Z[:,free_dims] * model._Xscale[:,free_dims] + model._Xoffset[:,free_dims]
|
|
||||||
Zu = param_to_array(model.Z[:,free_dims])
|
|
||||||
z_height = ax.get_ylim()[0]
|
|
||||||
ax.plot(Zu, np.zeros_like(Zu) + z_height, 'r|', mew=1.5, markersize=12)
|
|
||||||
|
|
||||||
|
|
||||||
#add error bars for uncertain (if input uncertainty is being modelled)
|
#add error bars for uncertain (if input uncertainty is being modelled)
|
||||||
if hasattr(model,"has_uncertain_inputs"):
|
if hasattr(model,"has_uncertain_inputs"):
|
||||||
ax.errorbar(model.X[which_data, free_dims], model.likelihood.data[which_data, 0],
|
ax.errorbar(model.X[which_data, free_dims], model.likelihood.data[which_data, 0],
|
||||||
|
|
@ -115,6 +108,15 @@ def plot_fit(model, plot_limits=None, which_data_rows='all',
|
||||||
ax.set_xlim(xmin, xmax)
|
ax.set_xlim(xmin, xmax)
|
||||||
ax.set_ylim(ymin, ymax)
|
ax.set_ylim(ymin, ymax)
|
||||||
|
|
||||||
|
#add inducing inputs (if a sparse model is used)
|
||||||
|
if hasattr(model,"Z"):
|
||||||
|
#Zu = model.Z[:,free_dims] * model._Xscale[:,free_dims] + model._Xoffset[:,free_dims]
|
||||||
|
Zu = param_to_array(model.Z[:,free_dims])
|
||||||
|
z_height = ax.get_ylim()[0]
|
||||||
|
ax.plot(Zu, np.zeros_like(Zu) + z_height, 'r|', mew=1.5, markersize=12)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#2D plotting
|
#2D plotting
|
||||||
elif len(free_dims) == 2:
|
elif len(free_dims) == 2:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue