mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-27 14:25:16 +02:00
Merge remote-tracking branch 'upstream/devel' into devel
This commit is contained in:
commit
52c6fe599f
14 changed files with 106 additions and 99 deletions
|
|
@ -1 +1 @@
|
||||||
__version__ = "0.9.4"
|
__version__ = "0.9.5"
|
||||||
|
|
|
||||||
|
|
@ -190,8 +190,8 @@ class VarDTC(LatentFunctionInference):
|
||||||
tmp, _ = dtrtrs(Lm, psi1V, lower=1, trans=0)
|
tmp, _ = dtrtrs(Lm, psi1V, lower=1, trans=0)
|
||||||
tmp, _ = dpotrs(LB, tmp, lower=1)
|
tmp, _ = dpotrs(LB, tmp, lower=1)
|
||||||
woodbury_vector, _ = dtrtrs(Lm, tmp, lower=1, trans=1)
|
woodbury_vector, _ = dtrtrs(Lm, tmp, lower=1, trans=1)
|
||||||
Bi, _ = dpotri(LB, lower=1)
|
#Bi, _ = dpotri(LB, lower=1)
|
||||||
symmetrify(Bi)
|
#symmetrify(Bi)
|
||||||
Bi = -dpotri(LB, lower=1)[0]
|
Bi = -dpotri(LB, lower=1)[0]
|
||||||
diag.add(Bi, 1)
|
diag.add(Bi, 1)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,4 @@ from .src.trunclinear import TruncLinear,TruncLinear_inf
|
||||||
from .src.splitKern import SplitKern,DEtime
|
from .src.splitKern import SplitKern,DEtime
|
||||||
from .src.splitKern import DEtime as DiffGenomeKern
|
from .src.splitKern import DEtime as DiffGenomeKern
|
||||||
from .src.spline import Spline
|
from .src.spline import Spline
|
||||||
from .src.basis_funcs import LinearSlopeBasisFuncKernel, BasisFuncKernel, ChangePointBasisFuncKernel, DomainKernel
|
from .src.basis_funcs import LogisticBasisFuncKernel, LinearSlopeBasisFuncKernel, BasisFuncKernel, ChangePointBasisFuncKernel, DomainKernel
|
||||||
|
|
@ -18,7 +18,7 @@ class ODE_UYC(Kern):
|
||||||
self.lengthscale_U = Param('lengthscale_U', lengthscale_U, Logexp())
|
self.lengthscale_U = Param('lengthscale_U', lengthscale_U, Logexp())
|
||||||
self.ubias = Param('ubias', ubias, Logexp())
|
self.ubias = Param('ubias', ubias, Logexp())
|
||||||
|
|
||||||
self.add_parameters(self.variance_Y, self.variance_U, self.lengthscale_Y, self.lengthscale_U, self.ubias)
|
self.link_parameters(self.variance_Y, self.variance_U, self.lengthscale_Y, self.lengthscale_U, self.ubias)
|
||||||
|
|
||||||
def K(self, X, X2=None):
|
def K(self, X, X2=None):
|
||||||
# model : a * dy/dt + b * y = U
|
# model : a * dy/dt + b * y = U
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class ODE_st(Kern):
|
||||||
self.b = Param('b', b, Logexp())
|
self.b = Param('b', b, Logexp())
|
||||||
self.c = Param('c', c, Logexp())
|
self.c = Param('c', c, Logexp())
|
||||||
|
|
||||||
self.add_parameters(self.a, self.b, self.c, self.variance_Yt, self.variance_Yx, self.lengthscale_Yt,self.lengthscale_Yx)
|
self.link_parameters(self.a, self.b, self.c, self.variance_Yt, self.variance_Yx, self.lengthscale_Yt,self.lengthscale_Yx)
|
||||||
|
|
||||||
|
|
||||||
def K(self, X, X2=None):
|
def K(self, X, X2=None):
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class ODE_t(Kern):
|
||||||
self.a= Param('a', a, Logexp())
|
self.a= Param('a', a, Logexp())
|
||||||
self.c = Param('c', c, Logexp())
|
self.c = Param('c', c, Logexp())
|
||||||
self.ubias = Param('ubias', ubias, Logexp())
|
self.ubias = Param('ubias', ubias, Logexp())
|
||||||
self.add_parameters(self.a, self.c, self.variance_Yt, self.lengthscale_Yt,self.ubias)
|
self.link_parameters(self.a, self.c, self.variance_Yt, self.lengthscale_Yt,self.ubias)
|
||||||
|
|
||||||
def K(self, X, X2=None):
|
def K(self, X, X2=None):
|
||||||
"""Compute the covariance matrix between X and X2."""
|
"""Compute the covariance matrix between X and X2."""
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,17 @@ def _wait_for_updates(view, updates):
|
||||||
# No updateable view:
|
# No updateable view:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def _new_canvas(self, projection, kwargs, which_indices):
|
||||||
|
input_1, input_2, input_3 = sig_dims = self.get_most_significant_input_dimensions(which_indices)
|
||||||
|
|
||||||
|
if input_3 is None:
|
||||||
|
zlabel = None
|
||||||
|
else:
|
||||||
|
zlabel = 'latent dimension %i' % input_3
|
||||||
|
canvas, kwargs = pl().new_canvas(projection=projection, xlabel='latent dimension %i' % input_1,
|
||||||
|
ylabel='latent dimension %i' % input_2,
|
||||||
|
zlabel=zlabel, **kwargs)
|
||||||
|
return canvas, projection, kwargs, sig_dims
|
||||||
|
|
||||||
def _plot_latent_scatter(canvas, X, visible_dims, labels, marker, num_samples, projection='2d', **kwargs):
|
def _plot_latent_scatter(canvas, X, visible_dims, labels, marker, num_samples, projection='2d', **kwargs):
|
||||||
from .. import Tango
|
from .. import Tango
|
||||||
|
|
@ -85,12 +96,8 @@ def plot_latent_scatter(self, labels=None,
|
||||||
:param str marker: markers to use - cycle if more labels then markers are given
|
:param str marker: markers to use - cycle if more labels then markers are given
|
||||||
:param kwargs: the kwargs for the scatter plots
|
:param kwargs: the kwargs for the scatter plots
|
||||||
"""
|
"""
|
||||||
input_1, input_2, input_3 = sig_dims = self.get_most_significant_input_dimensions(which_indices)
|
canvas, projection, kwargs, sig_dims = _new_canvas(self, projection, kwargs, which_indices)
|
||||||
|
|
||||||
canvas, kwargs = pl().new_canvas(projection=projection,
|
|
||||||
xlabel='latent dimension %i' % input_1,
|
|
||||||
ylabel='latent dimension %i' % input_2,
|
|
||||||
zlabel='latent dimension %i' % input_3, **kwargs)
|
|
||||||
X, _, _ = get_x_y_var(self)
|
X, _, _ = get_x_y_var(self)
|
||||||
if labels is None:
|
if labels is None:
|
||||||
labels = np.ones(self.num_data)
|
labels = np.ones(self.num_data)
|
||||||
|
|
@ -101,8 +108,6 @@ def plot_latent_scatter(self, labels=None,
|
||||||
return pl().add_to_canvas(canvas, dict(scatter=scatters), legend=legend)
|
return pl().add_to_canvas(canvas, dict(scatter=scatters), legend=legend)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def plot_latent_inducing(self,
|
def plot_latent_inducing(self,
|
||||||
which_indices=None,
|
which_indices=None,
|
||||||
legend=False,
|
legend=False,
|
||||||
|
|
@ -122,17 +127,8 @@ def plot_latent_inducing(self,
|
||||||
:param str marker: markers to use - cycle if more labels then markers are given
|
:param str marker: markers to use - cycle if more labels then markers are given
|
||||||
:param kwargs: the kwargs for the scatter plots
|
:param kwargs: the kwargs for the scatter plots
|
||||||
"""
|
"""
|
||||||
input_1, input_2, input_3 = sig_dims = self.get_most_significant_input_dimensions(which_indices)
|
canvas, projection, kwargs, sig_dims = _new_canvas(self, projection, kwargs, which_indices)
|
||||||
if input_3 is None: zlabel=None
|
|
||||||
else: zlabel = 'latent dimension %i' % input_3
|
|
||||||
|
|
||||||
|
|
||||||
if 'color' not in kwargs:
|
|
||||||
kwargs['color'] = 'white'
|
|
||||||
canvas, kwargs = pl().new_canvas(projection=projection,
|
|
||||||
xlabel='latent dimension %i' % input_1,
|
|
||||||
ylabel='latent dimension %i' % input_2,
|
|
||||||
zlabel=zlabel, **kwargs)
|
|
||||||
Z = self.Z.values
|
Z = self.Z.values
|
||||||
labels = np.array(['inducing'] * Z.shape[0])
|
labels = np.array(['inducing'] * Z.shape[0])
|
||||||
scatters = _plot_latent_scatter(canvas, Z, sig_dims, labels, marker, num_samples, projection=projection, **kwargs)
|
scatters = _plot_latent_scatter(canvas, Z, sig_dims, labels, marker, num_samples, projection=projection, **kwargs)
|
||||||
|
|
@ -231,7 +227,7 @@ def plot_latent(self, labels=None, which_indices=None,
|
||||||
plot_limits=None,
|
plot_limits=None,
|
||||||
updates=False,
|
updates=False,
|
||||||
kern=None, marker='<>^vsd',
|
kern=None, marker='<>^vsd',
|
||||||
num_samples=1000,
|
num_samples=1000, projection='2d',
|
||||||
scatter_kwargs=None, **imshow_kwargs):
|
scatter_kwargs=None, **imshow_kwargs):
|
||||||
"""
|
"""
|
||||||
Plot the latent space of the GP on the inputs. This is the
|
Plot the latent space of the GP on the inputs. This is the
|
||||||
|
|
@ -251,6 +247,8 @@ def plot_latent(self, labels=None, which_indices=None,
|
||||||
:param imshow_kwargs: the kwargs for the imshow (magnification factor)
|
:param imshow_kwargs: the kwargs for the imshow (magnification factor)
|
||||||
:param scatter_kwargs: the kwargs for the scatter plots
|
:param scatter_kwargs: the kwargs for the scatter plots
|
||||||
"""
|
"""
|
||||||
|
if projection != '2d':
|
||||||
|
raise ValueError('Cannot plot latent in other then 2 dimensions, consider plot_scatter')
|
||||||
input_1, input_2 = which_indices = self.get_most_significant_input_dimensions(which_indices)[:2]
|
input_1, input_2 = which_indices = self.get_most_significant_input_dimensions(which_indices)[:2]
|
||||||
X = get_x_y_var(self)[0]
|
X = get_x_y_var(self)[0]
|
||||||
_, _, Xgrid, _, _, xmin, xmax, resolution = helper_for_plot_data(self, X, plot_limits, which_indices, None, resolution)
|
_, _, Xgrid, _, _, xmin, xmax, resolution = helper_for_plot_data(self, X, plot_limits, which_indices, None, resolution)
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class MatplotlibPlots(AbstractPlottingLibrary):
|
||||||
fig.cols = cols
|
fig.cols = cols
|
||||||
return fig
|
return fig
|
||||||
|
|
||||||
def new_canvas(self, figure=None, col=1, row=1, projection='2d', xlabel=None, ylabel=None, zlabel=None, title=None, xlim=None, ylim=None, zlim=None, **kwargs):
|
def new_canvas(self, figure=None, row=1, col=1, projection='2d', xlabel=None, ylabel=None, zlabel=None, title=None, xlim=None, ylim=None, zlim=None, **kwargs):
|
||||||
if projection == '3d':
|
if projection == '3d':
|
||||||
from mpl_toolkits.mplot3d import Axes3D
|
from mpl_toolkits.mplot3d import Axes3D
|
||||||
elif projection == '2d':
|
elif projection == '2d':
|
||||||
|
|
|
||||||
|
|
@ -72,5 +72,5 @@ ard = dict(linewidth=1.2, barmode='stack')
|
||||||
latent = dict(colorscale='Greys', reversescale=True, zsmooth='best')
|
latent = dict(colorscale='Greys', reversescale=True, zsmooth='best')
|
||||||
gradient = dict(colorscale='RdBu', opacity=.7)
|
gradient = dict(colorscale='RdBu', opacity=.7)
|
||||||
magnification = dict(colorscale='Greys', zsmooth='best', reversescale=True)
|
magnification = dict(colorscale='Greys', zsmooth='best', reversescale=True)
|
||||||
latent_scatter = dict(marker_kwargs=dict(size='15', opacity=.7))
|
latent_scatter = dict(marker_kwargs=dict(size='5', opacity=.7))
|
||||||
# annotation = dict(fontdict=dict(family='sans-serif', weight='light', fontsize=9), zorder=.3, alpha=.7)
|
# annotation = dict(fontdict=dict(family='sans-serif', weight='light', fontsize=9), zorder=.3, alpha=.7)
|
||||||
|
|
@ -130,11 +130,12 @@ class PlotlyPlots(AbstractPlottingLibrary):
|
||||||
except:
|
except:
|
||||||
#not matplotlib marker
|
#not matplotlib marker
|
||||||
pass
|
pass
|
||||||
|
marker_kwargs = marker_kwargs or {}
|
||||||
marker_kwargs.setdefault('symbol', marker)
|
marker_kwargs.setdefault('symbol', marker)
|
||||||
if Z is not None:
|
if Z is not None:
|
||||||
return Scatter3d(x=X, y=Y, z=Z, mode='markers',
|
return Scatter3d(x=X, y=Y, z=Z, mode='markers',
|
||||||
showlegend=label is not None,
|
showlegend=label is not None,
|
||||||
marker=Marker(color=color, colorscale=cmap, **marker_kwargs or {}),
|
marker=Marker(color=color, colorscale=cmap, **marker_kwargs),
|
||||||
name=label, **kwargs)
|
name=label, **kwargs)
|
||||||
return Scatter(x=X, y=Y, mode='markers', showlegend=label is not None,
|
return Scatter(x=X, y=Y, mode='markers', showlegend=label is not None,
|
||||||
marker=Marker(color=color, colorscale=cmap, **marker_kwargs or {}),
|
marker=Marker(color=color, colorscale=cmap, **marker_kwargs or {}),
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 9 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 9 KiB |
|
|
@ -27,13 +27,21 @@
|
||||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
|
|
||||||
|
#===============================================================================
|
||||||
|
# SKIPPING PLOTTING BECAUSE IT BEHAVES DIFFERENTLY ON DIFFERENT
|
||||||
|
# SYSTEMS, AND WILL MISBEHAVE
|
||||||
|
from nose import SkipTest
|
||||||
|
raise SkipTest("Skipping Matplotlib testing")
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
import matplotlib
|
import matplotlib
|
||||||
from unittest.case import TestCase
|
from unittest.case import TestCase
|
||||||
matplotlib.use('agg')
|
matplotlib.use('agg')
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import GPy, os
|
import GPy, os
|
||||||
from nose import SkipTest
|
|
||||||
|
|
||||||
from GPy.util.config import config
|
from GPy.util.config import config
|
||||||
from GPy.plotting import change_plotting_library, plotting_library
|
from GPy.plotting import change_plotting_library, plotting_library
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
[bumpversion]
|
[bumpversion]
|
||||||
current_version = 0.9.4
|
current_version = 0.9.5
|
||||||
tag = True
|
tag = True
|
||||||
commit = True
|
commit = True
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue