diff --git a/GPy/__version__.py b/GPy/__version__.py index 382021f30..9e604c040 100644 --- a/GPy/__version__.py +++ b/GPy/__version__.py @@ -1 +1 @@ -__version__ = "1.0.6" +__version__ = "1.0.7" diff --git a/GPy/plotting/gpy_plot/data_plots.py b/GPy/plotting/gpy_plot/data_plots.py index a24a67ab5..5e6373e5a 100644 --- a/GPy/plotting/gpy_plot/data_plots.py +++ b/GPy/plotting/gpy_plot/data_plots.py @@ -175,7 +175,7 @@ def _plot_inducing(self, canvas, visible_dims, projection, label, **plot_kwargs) visible_dims = [i for i in sig_dims if i is not None] free_dims = get_free_dims(self, visible_dims, None) - Z = self.Z[:, free_dims] + Z = self.Z.values plots = {} #one dimensional plotting diff --git a/GPy/plotting/gpy_plot/latent_plots.py b/GPy/plotting/gpy_plot/latent_plots.py index f522d297d..f76fda1cd 100644 --- a/GPy/plotting/gpy_plot/latent_plots.py +++ b/GPy/plotting/gpy_plot/latent_plots.py @@ -112,28 +112,29 @@ def plot_latent_inducing(self, which_indices=None, legend=False, plot_limits=None, - marker='^', - num_samples=1000, + marker=None, projection='2d', **kwargs): """ Plot a scatter plot of the inducing inputs. - :param array-like labels: a label for each data point (row) of the inputs - :param (int, int) which_indices: which input dimensions to plot against each other + :param [int] which_indices: which input dimensions to plot against each other :param bool legend: whether to plot the legend on the figure :param plot_limits: the plot limits for the plot :type plot_limits: (xmin, xmax, ymin, ymax) or ((xmin, xmax), (ymin, ymax)) - :param str marker: markers to use - cycle if more labels then markers are given + :param str marker: marker to use [default is custom arrow like] :param kwargs: the kwargs for the scatter plots + :param str projection: for now 2d or 3d projection (other projections can be implemented, see developer documentation) """ canvas, projection, kwargs, sig_dims = _new_canvas(self, projection, kwargs, which_indices) - Z = self.Z.values - labels = np.array(['inducing'] * Z.shape[0]) - kwargs['marker'] = marker + if legend: label = 'inducing' + else: label = None + if marker is not None: + kwargs['marker'] = marker update_not_existing_kwargs(kwargs, pl().defaults.inducing_2d) # @UndefinedVariable - scatters = _plot_latent_scatter(canvas, Z, sig_dims, labels, num_samples=num_samples, projection=projection, **kwargs) + from .data_plots import _plot_inducing + scatters = _plot_inducing(self, canvas, sig_dims[:2], projection, label, **kwargs) return pl().add_to_canvas(canvas, dict(scatter=scatters), legend=legend) diff --git a/GPy/plotting/matplot_dep/defaults.py b/GPy/plotting/matplot_dep/defaults.py index 38b08dd10..8518b9d03 100644 --- a/GPy/plotting/matplot_dep/defaults.py +++ b/GPy/plotting/matplot_dep/defaults.py @@ -45,7 +45,7 @@ # Data plots: data_1d = dict(lw=1.5, marker='x', color='k') data_2d = dict(s=35, edgecolors='none', linewidth=0., cmap=cm.get_cmap('hot'), alpha=.5) -inducing_1d = dict(lw=0, s=500, facecolors=Tango.colorsHex['darkRed']) +inducing_1d = dict(lw=0, s=500, color=Tango.colorsHex['darkRed']) inducing_2d = dict(s=17, edgecolor='k', linewidth=.4, color='white', alpha=.5, marker='^') inducing_3d = dict(lw=.3, s=500, color=Tango.colorsHex['darkRed'], edgecolor='k') xerrorbar = dict(color='k', fmt='none', elinewidth=.5, alpha=.5) diff --git a/GPy/plotting/matplot_dep/plot_definitions.py b/GPy/plotting/matplot_dep/plot_definitions.py index 52100ea33..0e3bc32d3 100644 --- a/GPy/plotting/matplot_dep/plot_definitions.py +++ b/GPy/plotting/matplot_dep/plot_definitions.py @@ -106,7 +106,7 @@ def plot(self, ax, X, Y, Z=None, color=None, label=None, **kwargs): return ax.plot(X, Y, color=color, zs=Z, label=label, **kwargs) return ax.plot(X, Y, color=color, label=label, **kwargs) - def plot_axis_lines(self, ax, X, color=Tango.colorsHex['mediumBlue'], label=None, **kwargs): + def plot_axis_lines(self, ax, X, color=Tango.colorsHex['darkRed'], label=None, **kwargs): from matplotlib import transforms from matplotlib.path import Path if 'marker' not in kwargs: @@ -126,14 +126,14 @@ def barplot(self, ax, x, height, width=0.8, bottom=0, color=Tango.colorsHex['med bottom=bottom, label=label, color=color, **kwargs) - def xerrorbar(self, ax, X, Y, error, color=Tango.colorsHex['mediumBlue'], label=None, **kwargs): + def xerrorbar(self, ax, X, Y, error, color=Tango.colorsHex['darkRed'], label=None, **kwargs): if not('linestyle' in kwargs or 'ls' in kwargs): kwargs['ls'] = 'none' #if Z is not None: # return ax.errorbar(X, Y, Z, xerr=error, ecolor=color, label=label, **kwargs) return ax.errorbar(X, Y, xerr=error, ecolor=color, label=label, **kwargs) - def yerrorbar(self, ax, X, Y, error, color=Tango.colorsHex['mediumBlue'], label=None, **kwargs): + def yerrorbar(self, ax, X, Y, error, color=Tango.colorsHex['darkRed'], label=None, **kwargs): if not('linestyle' in kwargs or 'ls' in kwargs): kwargs['ls'] = 'none' #if Z is not None: diff --git a/GPy/testing/baseline/bayesian_gplvm_gradient.npz b/GPy/testing/baseline/bayesian_gplvm_gradient.npz new file mode 100644 index 000000000..f3b56c490 Binary files /dev/null and b/GPy/testing/baseline/bayesian_gplvm_gradient.npz differ diff --git a/GPy/testing/baseline/bayesian_gplvm_gradient.png b/GPy/testing/baseline/bayesian_gplvm_gradient.png deleted file mode 100644 index e607caad6..000000000 Binary files a/GPy/testing/baseline/bayesian_gplvm_gradient.png and /dev/null differ diff --git a/GPy/testing/baseline/bayesian_gplvm_inducing.npz b/GPy/testing/baseline/bayesian_gplvm_inducing.npz new file mode 100644 index 000000000..2ad1866af Binary files /dev/null and b/GPy/testing/baseline/bayesian_gplvm_inducing.npz differ diff --git a/GPy/testing/baseline/bayesian_gplvm_inducing.png b/GPy/testing/baseline/bayesian_gplvm_inducing.png deleted file mode 100644 index dd7e66f2c..000000000 Binary files a/GPy/testing/baseline/bayesian_gplvm_inducing.png and /dev/null differ diff --git a/GPy/testing/baseline/bayesian_gplvm_inducing_3d.npz b/GPy/testing/baseline/bayesian_gplvm_inducing_3d.npz new file mode 100644 index 000000000..02c89096c Binary files /dev/null and b/GPy/testing/baseline/bayesian_gplvm_inducing_3d.npz differ diff --git a/GPy/testing/baseline/bayesian_gplvm_inducing_3d.png b/GPy/testing/baseline/bayesian_gplvm_inducing_3d.png deleted file mode 100644 index ae541f2e0..000000000 Binary files a/GPy/testing/baseline/bayesian_gplvm_inducing_3d.png and /dev/null differ diff --git a/GPy/testing/baseline/bayesian_gplvm_latent.npz b/GPy/testing/baseline/bayesian_gplvm_latent.npz new file mode 100644 index 000000000..3fba9c062 Binary files /dev/null and b/GPy/testing/baseline/bayesian_gplvm_latent.npz differ diff --git a/GPy/testing/baseline/bayesian_gplvm_latent.png b/GPy/testing/baseline/bayesian_gplvm_latent.png deleted file mode 100644 index 85c17a6e6..000000000 Binary files a/GPy/testing/baseline/bayesian_gplvm_latent.png and /dev/null differ diff --git a/GPy/testing/baseline/bayesian_gplvm_latent_3d.npz b/GPy/testing/baseline/bayesian_gplvm_latent_3d.npz new file mode 100644 index 000000000..a4f4edadf Binary files /dev/null and b/GPy/testing/baseline/bayesian_gplvm_latent_3d.npz differ diff --git a/GPy/testing/baseline/bayesian_gplvm_latent_3d.png b/GPy/testing/baseline/bayesian_gplvm_latent_3d.png deleted file mode 100644 index 1bba1b64e..000000000 Binary files a/GPy/testing/baseline/bayesian_gplvm_latent_3d.png and /dev/null differ diff --git a/GPy/testing/baseline/bayesian_gplvm_magnification.npz b/GPy/testing/baseline/bayesian_gplvm_magnification.npz new file mode 100644 index 000000000..cd5ff3037 Binary files /dev/null and b/GPy/testing/baseline/bayesian_gplvm_magnification.npz differ diff --git a/GPy/testing/baseline/bayesian_gplvm_magnification.png b/GPy/testing/baseline/bayesian_gplvm_magnification.png deleted file mode 100644 index 4777e89f9..000000000 Binary files a/GPy/testing/baseline/bayesian_gplvm_magnification.png and /dev/null differ diff --git a/GPy/testing/baseline/coverage_3d_plot.npz b/GPy/testing/baseline/coverage_3d_plot.npz new file mode 100644 index 000000000..cdf55bc8d Binary files /dev/null and b/GPy/testing/baseline/coverage_3d_plot.npz differ diff --git a/GPy/testing/baseline/coverage_3d_plot.png b/GPy/testing/baseline/coverage_3d_plot.png deleted file mode 100644 index 43f165e63..000000000 Binary files a/GPy/testing/baseline/coverage_3d_plot.png and /dev/null differ diff --git a/GPy/testing/baseline/coverage_annotation_interact.npz b/GPy/testing/baseline/coverage_annotation_interact.npz new file mode 100644 index 000000000..437ad4985 Binary files /dev/null and b/GPy/testing/baseline/coverage_annotation_interact.npz differ diff --git a/GPy/testing/baseline/coverage_annotation_interact.png b/GPy/testing/baseline/coverage_annotation_interact.png deleted file mode 100644 index f51d20d23..000000000 Binary files a/GPy/testing/baseline/coverage_annotation_interact.png and /dev/null differ diff --git a/GPy/testing/baseline/coverage_gradient.npz b/GPy/testing/baseline/coverage_gradient.npz new file mode 100644 index 000000000..32eaf6c63 Binary files /dev/null and b/GPy/testing/baseline/coverage_gradient.npz differ diff --git a/GPy/testing/baseline/coverage_gradient.png b/GPy/testing/baseline/coverage_gradient.png deleted file mode 100644 index aa4b67186..000000000 Binary files a/GPy/testing/baseline/coverage_gradient.png and /dev/null differ diff --git a/GPy/testing/baseline/coverage_imshow_interact.npz b/GPy/testing/baseline/coverage_imshow_interact.npz new file mode 100644 index 000000000..78dd7755b Binary files /dev/null and b/GPy/testing/baseline/coverage_imshow_interact.npz differ diff --git a/GPy/testing/baseline/coverage_imshow_interact.png b/GPy/testing/baseline/coverage_imshow_interact.png deleted file mode 100644 index 879bfcef8..000000000 Binary files a/GPy/testing/baseline/coverage_imshow_interact.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_2d_data.npz b/GPy/testing/baseline/gp_2d_data.npz new file mode 100644 index 000000000..773660eb6 Binary files /dev/null and b/GPy/testing/baseline/gp_2d_data.npz differ diff --git a/GPy/testing/baseline/gp_2d_data.png b/GPy/testing/baseline/gp_2d_data.png deleted file mode 100644 index 7c8cf2042..000000000 Binary files a/GPy/testing/baseline/gp_2d_data.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_2d_in_error.npz b/GPy/testing/baseline/gp_2d_in_error.npz new file mode 100644 index 000000000..00ca4ecad Binary files /dev/null and b/GPy/testing/baseline/gp_2d_in_error.npz differ diff --git a/GPy/testing/baseline/gp_2d_in_error.png b/GPy/testing/baseline/gp_2d_in_error.png deleted file mode 100644 index b3168e7ce..000000000 Binary files a/GPy/testing/baseline/gp_2d_in_error.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_2d_inducing.npz b/GPy/testing/baseline/gp_2d_inducing.npz new file mode 100644 index 000000000..ce6404fc7 Binary files /dev/null and b/GPy/testing/baseline/gp_2d_inducing.npz differ diff --git a/GPy/testing/baseline/gp_2d_inducing.png b/GPy/testing/baseline/gp_2d_inducing.png deleted file mode 100644 index f669c9af3..000000000 Binary files a/GPy/testing/baseline/gp_2d_inducing.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_2d_mean.npz b/GPy/testing/baseline/gp_2d_mean.npz new file mode 100644 index 000000000..238dc0285 Binary files /dev/null and b/GPy/testing/baseline/gp_2d_mean.npz differ diff --git a/GPy/testing/baseline/gp_2d_mean.png b/GPy/testing/baseline/gp_2d_mean.png deleted file mode 100644 index 02fb271f3..000000000 Binary files a/GPy/testing/baseline/gp_2d_mean.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_3d_data.npz b/GPy/testing/baseline/gp_3d_data.npz new file mode 100644 index 000000000..1f52eab48 Binary files /dev/null and b/GPy/testing/baseline/gp_3d_data.npz differ diff --git a/GPy/testing/baseline/gp_3d_data.png b/GPy/testing/baseline/gp_3d_data.png deleted file mode 100644 index 45e3ca49a..000000000 Binary files a/GPy/testing/baseline/gp_3d_data.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_3d_inducing.npz b/GPy/testing/baseline/gp_3d_inducing.npz new file mode 100644 index 000000000..676a16e54 Binary files /dev/null and b/GPy/testing/baseline/gp_3d_inducing.npz differ diff --git a/GPy/testing/baseline/gp_3d_inducing.png b/GPy/testing/baseline/gp_3d_inducing.png deleted file mode 100644 index 35dada708..000000000 Binary files a/GPy/testing/baseline/gp_3d_inducing.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_3d_mean.npz b/GPy/testing/baseline/gp_3d_mean.npz new file mode 100644 index 000000000..1a5eed423 Binary files /dev/null and b/GPy/testing/baseline/gp_3d_mean.npz differ diff --git a/GPy/testing/baseline/gp_3d_mean.png b/GPy/testing/baseline/gp_3d_mean.png deleted file mode 100644 index 5433934de..000000000 Binary files a/GPy/testing/baseline/gp_3d_mean.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_class_likelihood.npz b/GPy/testing/baseline/gp_class_likelihood.npz new file mode 100644 index 000000000..6db3e8ff6 Binary files /dev/null and b/GPy/testing/baseline/gp_class_likelihood.npz differ diff --git a/GPy/testing/baseline/gp_class_likelihood.png b/GPy/testing/baseline/gp_class_likelihood.png deleted file mode 100644 index d99a004ff..000000000 Binary files a/GPy/testing/baseline/gp_class_likelihood.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_class_raw.npz b/GPy/testing/baseline/gp_class_raw.npz new file mode 100644 index 000000000..f49a775fd Binary files /dev/null and b/GPy/testing/baseline/gp_class_raw.npz differ diff --git a/GPy/testing/baseline/gp_class_raw.png b/GPy/testing/baseline/gp_class_raw.png deleted file mode 100644 index 1d6990e06..000000000 Binary files a/GPy/testing/baseline/gp_class_raw.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_class_raw_link.npz b/GPy/testing/baseline/gp_class_raw_link.npz new file mode 100644 index 000000000..231adca7e Binary files /dev/null and b/GPy/testing/baseline/gp_class_raw_link.npz differ diff --git a/GPy/testing/baseline/gp_class_raw_link.png b/GPy/testing/baseline/gp_class_raw_link.png deleted file mode 100644 index 9c207acd7..000000000 Binary files a/GPy/testing/baseline/gp_class_raw_link.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_conf.npz b/GPy/testing/baseline/gp_conf.npz new file mode 100644 index 000000000..d178b5c0d Binary files /dev/null and b/GPy/testing/baseline/gp_conf.npz differ diff --git a/GPy/testing/baseline/gp_conf.png b/GPy/testing/baseline/gp_conf.png deleted file mode 100644 index 13885af35..000000000 Binary files a/GPy/testing/baseline/gp_conf.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_data.npz b/GPy/testing/baseline/gp_data.npz new file mode 100644 index 000000000..fef7d0f52 Binary files /dev/null and b/GPy/testing/baseline/gp_data.npz differ diff --git a/GPy/testing/baseline/gp_data.png b/GPy/testing/baseline/gp_data.png deleted file mode 100644 index 780fe3896..000000000 Binary files a/GPy/testing/baseline/gp_data.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_density.npz b/GPy/testing/baseline/gp_density.npz new file mode 100644 index 000000000..9bf3d757e Binary files /dev/null and b/GPy/testing/baseline/gp_density.npz differ diff --git a/GPy/testing/baseline/gp_density.png b/GPy/testing/baseline/gp_density.png deleted file mode 100644 index 34d4c9255..000000000 Binary files a/GPy/testing/baseline/gp_density.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_in_error.npz b/GPy/testing/baseline/gp_in_error.npz new file mode 100644 index 000000000..eb6935917 Binary files /dev/null and b/GPy/testing/baseline/gp_in_error.npz differ diff --git a/GPy/testing/baseline/gp_in_error.png b/GPy/testing/baseline/gp_in_error.png deleted file mode 100644 index 8c8d13de6..000000000 Binary files a/GPy/testing/baseline/gp_in_error.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_mean.npz b/GPy/testing/baseline/gp_mean.npz new file mode 100644 index 000000000..e47dad83e Binary files /dev/null and b/GPy/testing/baseline/gp_mean.npz differ diff --git a/GPy/testing/baseline/gp_mean.png b/GPy/testing/baseline/gp_mean.png deleted file mode 100644 index b10198695..000000000 Binary files a/GPy/testing/baseline/gp_mean.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_out_error.npz b/GPy/testing/baseline/gp_out_error.npz new file mode 100644 index 000000000..967e322da Binary files /dev/null and b/GPy/testing/baseline/gp_out_error.npz differ diff --git a/GPy/testing/baseline/gp_out_error.png b/GPy/testing/baseline/gp_out_error.png deleted file mode 100644 index 696786f4a..000000000 Binary files a/GPy/testing/baseline/gp_out_error.png and /dev/null differ diff --git a/GPy/testing/baseline/gp_samples.npz b/GPy/testing/baseline/gp_samples.npz new file mode 100644 index 000000000..5f19e9c49 Binary files /dev/null and b/GPy/testing/baseline/gp_samples.npz differ diff --git a/GPy/testing/baseline/gp_samples.png b/GPy/testing/baseline/gp_samples.png deleted file mode 100644 index 95dbd4ffc..000000000 Binary files a/GPy/testing/baseline/gp_samples.png and /dev/null differ diff --git a/GPy/testing/baseline/gplvm_gradient.npz b/GPy/testing/baseline/gplvm_gradient.npz new file mode 100644 index 000000000..14ca0cfd1 Binary files /dev/null and b/GPy/testing/baseline/gplvm_gradient.npz differ diff --git a/GPy/testing/baseline/gplvm_gradient.png b/GPy/testing/baseline/gplvm_gradient.png deleted file mode 100644 index d3d0dc728..000000000 Binary files a/GPy/testing/baseline/gplvm_gradient.png and /dev/null differ diff --git a/GPy/testing/baseline/gplvm_latent.npz b/GPy/testing/baseline/gplvm_latent.npz new file mode 100644 index 000000000..fcd07f974 Binary files /dev/null and b/GPy/testing/baseline/gplvm_latent.npz differ diff --git a/GPy/testing/baseline/gplvm_latent.png b/GPy/testing/baseline/gplvm_latent.png deleted file mode 100644 index 5d3c92ae9..000000000 Binary files a/GPy/testing/baseline/gplvm_latent.png and /dev/null differ diff --git a/GPy/testing/baseline/gplvm_latent_3d.npz b/GPy/testing/baseline/gplvm_latent_3d.npz new file mode 100644 index 000000000..448362aef Binary files /dev/null and b/GPy/testing/baseline/gplvm_latent_3d.npz differ diff --git a/GPy/testing/baseline/gplvm_latent_3d.png b/GPy/testing/baseline/gplvm_latent_3d.png deleted file mode 100644 index 1bba1b64e..000000000 Binary files a/GPy/testing/baseline/gplvm_latent_3d.png and /dev/null differ diff --git a/GPy/testing/baseline/gplvm_magnification.npz b/GPy/testing/baseline/gplvm_magnification.npz new file mode 100644 index 000000000..7275a82ad Binary files /dev/null and b/GPy/testing/baseline/gplvm_magnification.npz differ diff --git a/GPy/testing/baseline/gplvm_magnification.png b/GPy/testing/baseline/gplvm_magnification.png deleted file mode 100644 index a271cf6cc..000000000 Binary files a/GPy/testing/baseline/gplvm_magnification.png and /dev/null differ diff --git a/GPy/testing/baseline/kern_ARD.npz b/GPy/testing/baseline/kern_ARD.npz new file mode 100644 index 000000000..77bedd3d5 Binary files /dev/null and b/GPy/testing/baseline/kern_ARD.npz differ diff --git a/GPy/testing/baseline/kern_ARD.png b/GPy/testing/baseline/kern_ARD.png deleted file mode 100644 index e56a5312a..000000000 Binary files a/GPy/testing/baseline/kern_ARD.png and /dev/null differ diff --git a/GPy/testing/baseline/kern_cov_1d.npz b/GPy/testing/baseline/kern_cov_1d.npz new file mode 100644 index 000000000..285e2e6da Binary files /dev/null and b/GPy/testing/baseline/kern_cov_1d.npz differ diff --git a/GPy/testing/baseline/kern_cov_1d.png b/GPy/testing/baseline/kern_cov_1d.png deleted file mode 100644 index 64c3a57f8..000000000 Binary files a/GPy/testing/baseline/kern_cov_1d.png and /dev/null differ diff --git a/GPy/testing/baseline/kern_cov_2d.npz b/GPy/testing/baseline/kern_cov_2d.npz new file mode 100644 index 000000000..d65d1d656 Binary files /dev/null and b/GPy/testing/baseline/kern_cov_2d.npz differ diff --git a/GPy/testing/baseline/kern_cov_2d.png b/GPy/testing/baseline/kern_cov_2d.png deleted file mode 100644 index 1df0e5d00..000000000 Binary files a/GPy/testing/baseline/kern_cov_2d.png and /dev/null differ diff --git a/GPy/testing/baseline/kern_cov_3d.npz b/GPy/testing/baseline/kern_cov_3d.npz new file mode 100644 index 000000000..b98bda426 Binary files /dev/null and b/GPy/testing/baseline/kern_cov_3d.npz differ diff --git a/GPy/testing/baseline/kern_cov_3d.png b/GPy/testing/baseline/kern_cov_3d.png deleted file mode 100644 index 52bff7cb3..000000000 Binary files a/GPy/testing/baseline/kern_cov_3d.png and /dev/null differ diff --git a/GPy/testing/baseline/kern_cov_no_lim.npz b/GPy/testing/baseline/kern_cov_no_lim.npz new file mode 100644 index 000000000..aa4b95123 Binary files /dev/null and b/GPy/testing/baseline/kern_cov_no_lim.npz differ diff --git a/GPy/testing/baseline/kern_cov_no_lim.png b/GPy/testing/baseline/kern_cov_no_lim.png deleted file mode 100644 index f8b91507b..000000000 Binary files a/GPy/testing/baseline/kern_cov_no_lim.png and /dev/null differ diff --git a/GPy/testing/baseline/sparse_gp_class_likelihood.npz b/GPy/testing/baseline/sparse_gp_class_likelihood.npz new file mode 100644 index 000000000..5aee46127 Binary files /dev/null and b/GPy/testing/baseline/sparse_gp_class_likelihood.npz differ diff --git a/GPy/testing/baseline/sparse_gp_class_likelihood.png b/GPy/testing/baseline/sparse_gp_class_likelihood.png deleted file mode 100644 index 55449be48..000000000 Binary files a/GPy/testing/baseline/sparse_gp_class_likelihood.png and /dev/null differ diff --git a/GPy/testing/baseline/sparse_gp_class_raw.npz b/GPy/testing/baseline/sparse_gp_class_raw.npz new file mode 100644 index 000000000..7c9404c80 Binary files /dev/null and b/GPy/testing/baseline/sparse_gp_class_raw.npz differ diff --git a/GPy/testing/baseline/sparse_gp_class_raw.png b/GPy/testing/baseline/sparse_gp_class_raw.png deleted file mode 100644 index 484d15f95..000000000 Binary files a/GPy/testing/baseline/sparse_gp_class_raw.png and /dev/null differ diff --git a/GPy/testing/baseline/sparse_gp_class_raw_link.npz b/GPy/testing/baseline/sparse_gp_class_raw_link.npz new file mode 100644 index 000000000..9512e9e74 Binary files /dev/null and b/GPy/testing/baseline/sparse_gp_class_raw_link.npz differ diff --git a/GPy/testing/baseline/sparse_gp_class_raw_link.png b/GPy/testing/baseline/sparse_gp_class_raw_link.png deleted file mode 100644 index c57424644..000000000 Binary files a/GPy/testing/baseline/sparse_gp_class_raw_link.png and /dev/null differ diff --git a/GPy/testing/baseline/sparse_gp_data_error.npz b/GPy/testing/baseline/sparse_gp_data_error.npz new file mode 100644 index 000000000..beaea488f Binary files /dev/null and b/GPy/testing/baseline/sparse_gp_data_error.npz differ diff --git a/GPy/testing/baseline/sparse_gp_data_error.png b/GPy/testing/baseline/sparse_gp_data_error.png deleted file mode 100644 index 9fe65c586..000000000 Binary files a/GPy/testing/baseline/sparse_gp_data_error.png and /dev/null differ diff --git a/GPy/testing/plotting_tests.py b/GPy/testing/plotting_tests.py index 3ab9ad102..07f4afd26 100644 --- a/GPy/testing/plotting_tests.py +++ b/GPy/testing/plotting_tests.py @@ -72,7 +72,7 @@ def test_change_plotting(self): except ImportError: raise SkipTest("Matplotlib not installed, not testing plots") -extensions = ['png'] +extensions = ['npz'] def _image_directories(): """ @@ -93,39 +93,107 @@ def _image_directories(): if not os.path.exists(baseline_dir): raise SkipTest("Not installed from source, baseline not available. Install from source to test plotting") -def _sequenceEqual(a, b): - assert len(a) == len(b), "Sequences not same length" - for i, [x, y], in enumerate(zip(a, b)): - assert x == y, "element not matching {}".format(i) +def _image_comparison(baseline_images, extensions=['pdf','svg','png'], tol=11, rtol=1e-3, **kwargs): -def _notFound(path): - raise IOError('File {} not in baseline') - -def _image_comparison(baseline_images, extensions=['pdf','svg','png'], tol=11): for num, base in zip(plt.get_fignums(), baseline_images): for ext in extensions: fig = plt.figure(num) + fig.canvas.draw() #fig.axes[0].set_axis_off() #fig.set_frameon(False) - fig.canvas.draw() - fig.savefig(os.path.join(result_dir, "{}.{}".format(base, ext)), - transparent=True, - edgecolor='none', - facecolor='none', - #bbox='tight' - ) + if ext in ['npz']: + figdict = flatten_axis(fig) + np.savez_compressed(os.path.join(result_dir, "{}.{}".format(base, ext)), **figdict) + fig.savefig(os.path.join(result_dir, "{}.{}".format(base, 'png')), + transparent=True, + edgecolor='none', + facecolor='none', + #bbox='tight' + ) + else: + fig.savefig(os.path.join(result_dir, "{}.{}".format(base, ext)), + transparent=True, + edgecolor='none', + facecolor='none', + #bbox='tight' + ) for num, base in zip(plt.get_fignums(), baseline_images): for ext in extensions: #plt.close(num) actual = os.path.join(result_dir, "{}.{}".format(base, ext)) expected = os.path.join(baseline_dir, "{}.{}".format(base, ext)) - def do_test(): - err = compare_images(expected, actual, tol, in_decorator=True) - if err: - raise SkipTest("Error between {} and {} is {:.5f}, which is bigger then the tolerance of {:.5f}".format(actual, expected, err['rms'], tol)) + if ext == 'npz': + def do_test(): + if not os.path.exists(expected): + import shutil + shutil.copy2(actual, expected) + #shutil.copy2(os.path.join(result_dir, "{}.{}".format(base, 'png')), os.path.join(baseline_dir, "{}.{}".format(base, 'png'))) + raise IOError("Baseline file {} not found, copying result {}".format(expected, actual)) + else: + exp_dict = dict(np.load(expected).items()) + act_dict = dict(np.load(actual).items()) + for name in act_dict: + if name in exp_dict: + try: + np.testing.assert_allclose(exp_dict[name], act_dict[name], err_msg="Mismatch in {}.{}".format(base, name), rtol=rtol, **kwargs) + except AssertionError as e: + raise SkipTest(e) + else: + def do_test(): + err = compare_images(expected, actual, tol, in_decorator=True) + if err: + raise SkipTest("Error between {} and {} is {:.5f}, which is bigger then the tolerance of {:.5f}".format(actual, expected, err['rms'], tol)) yield do_test plt.close('all') +def flatten_axis(ax, prevname=''): + import inspect + members = inspect.getmembers(ax) + + arrays = {} + + def _flatten(l, pre): + arr = {} + if isinstance(l, np.ndarray): + if l.size: + arr[pre] = np.asarray(l) + elif isinstance(l, dict): + for _n in l: + _tmp = _flatten(l, pre+"."+_n+".") + for _nt in _tmp.keys(): + arrays[_nt] = _tmp[_nt] + elif isinstance(l, list) and len(l)>0: + for i in range(len(l)): + _tmp = _flatten(l[i], pre+"[{}]".format(i)) + for _n in _tmp: + arr["{}".format(_n)] = _tmp[_n] + else: + return flatten_axis(l, pre+'.') + return arr + + + for name, l in members: + if isinstance(l, np.ndarray): + arrays[prevname+name] = np.asarray(l) + elif isinstance(l, list) and len(l)>0: + for i in range(len(l)): + _tmp = _flatten(l[i], prevname+name+"[{}]".format(i)) + for _n in _tmp: + arrays["{}".format(_n)] = _tmp[_n] + + return arrays + +def _a(x,y,decimal): + np.testing.assert_array_almost_equal(x, y, decimal) + +def compare_axis_dicts(x, y, decimal=6): + try: + assert(len(x)==len(y)) + for name in x: + _a(x[name], y[name], decimal) + except AssertionError as e: + raise SkipTest(e.message) + def test_figure(): np.random.seed(1239847) from GPy.plotting import plotting_library as pl @@ -187,7 +255,7 @@ def test_kernel(): k2.plot_ARD(['rbf', 'linear', 'bias'], legend=True) k2.plot_covariance(visible_dims=[0, 3], plot_limits=(-1,3)) k2.plot_covariance(visible_dims=[2], plot_limits=(-1, 3)) - k2.plot_covariance(visible_dims=[2, 4], plot_limits=((-1, 0), (5, 3)), projection='3d') + k2.plot_covariance(visible_dims=[2, 4], plot_limits=((-1, 0), (5, 3)), projection='3d', rstride=10, cstride=10) k2.plot_covariance(visible_dims=[1, 4]) for do_test in _image_comparison( baseline_images=['kern_{}'.format(sub) for sub in ["ARD", 'cov_2d', 'cov_1d', 'cov_3d', 'cov_no_lim']], @@ -260,7 +328,7 @@ def test_threed(): m.plot_samples(projection='3d', plot_raw=False, samples=1) plt.close('all') m.plot_data(projection='3d') - m.plot_mean(projection='3d') + m.plot_mean(projection='3d', rstride=10, cstride=10) m.plot_inducing(projection='3d') #m.plot_errorbars_trainset(projection='3d') for do_test in _image_comparison(baseline_images=['gp_3d_{}'.format(sub) for sub in ["data", "mean", 'inducing', @@ -325,7 +393,7 @@ def test_sparse_classification(): m.plot(plot_raw=True, apply_link=False, samples=3) np.random.seed(111) m.plot(plot_raw=True, apply_link=True, samples=3) - for do_test in _image_comparison(baseline_images=['sparse_gp_class_{}'.format(sub) for sub in ["likelihood", "raw", 'raw_link']], extensions=extensions): + for do_test in _image_comparison(baseline_images=['sparse_gp_class_{}'.format(sub) for sub in ["likelihood", "raw", 'raw_link']], extensions=extensions, rtol=2): yield (do_test, ) def test_gplvm(): diff --git a/README.rst b/README.rst deleted file mode 100644 index ffd47a409..000000000 --- a/README.rst +++ /dev/null @@ -1,16 +0,0 @@ -=== -GPy -=== - -The Gaussian processes framework in Python. -------------------------------------------- - -- `GPy homepage `_ -- `Tutorial notebooks `_ -- `User mailing-list `_ -- `Developer documentation `_ -- `Travis-CI unit-tests `_ -- .. image:: https://img.shields.io/badge/licence-BSD-blue.svg - :target: https://opensource.org/licenses/BSD-3-Clause - -For full description and installation instructions please refer to the github page. diff --git a/setup.cfg b/setup.cfg index c13a2a513..04d1f5ab7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.0.6 +current_version = 1.0.7 tag = False commit = True @@ -11,6 +11,3 @@ universal = 1 [upload_docs] upload-dir = doc/build/html -[metadata] -description-file = README.rst - diff --git a/setup.py b/setup.py index 509cc26d9..18e0c7d83 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,18 @@ def read_to_rst(fname): except ImportError: return read(fname) -desc = read('README.rst') +desc = """ + +- `GPy homepage `_ +- `Tutorial notebooks `_ +- `User mailing-list `_ +- `Developer documentation `_ +- `Travis-CI unit-tests `_ +- `License `_ + +For full description and installation instructions please refer to the github page. + +""" version_dummy = {} exec(read('GPy/__version__.py'), version_dummy) diff --git a/travis_tests.py b/travis_tests.py index e34df909d..5ad7bace1 100644 --- a/travis_tests.py +++ b/travis_tests.py @@ -36,5 +36,5 @@ import nose, warnings with warnings.catch_warnings(): warnings.simplefilter("ignore") - nose.main('GPy', defaultTest='GPy/testing/') + nose.main('GPy', defaultTest='GPy/testing/', argv=['', '-v'])