From 4b4e5d490191228ec3270e95abb5afd6e03a0fd4 Mon Sep 17 00:00:00 2001 From: Mike Croucher Date: Thu, 26 Feb 2015 09:01:27 +0000 Subject: [PATCH] Convert print to function for Python 3 compatibility --- GPy/plotting/matplot_dep/dim_reduction_plots.py | 6 +++--- GPy/plotting/matplot_dep/inference_plots.py | 2 +- GPy/plotting/matplot_dep/kernel_plots.py | 2 +- GPy/plotting/matplot_dep/maps.py | 4 ++-- GPy/plotting/matplot_dep/visualize.py | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/GPy/plotting/matplot_dep/dim_reduction_plots.py b/GPy/plotting/matplot_dep/dim_reduction_plots.py index 1398b40c..982f8fa9 100644 --- a/GPy/plotting/matplot_dep/dim_reduction_plots.py +++ b/GPy/plotting/matplot_dep/dim_reduction_plots.py @@ -62,7 +62,7 @@ def plot_latent(model, labels=None, which_indices=None, if X.shape[0] > 1000: - print "Warning: subsampling X, as it has more samples then 1000. X.shape={!s}".format(X.shape) + print("Warning: subsampling X, as it has more samples then 1000. X.shape={!s}".format(X.shape)) subsample = np.random.choice(X.shape[0], size=1000, replace=False) X = X[subsample] labels = labels[subsample] @@ -187,14 +187,14 @@ def plot_latent(model, labels=None, which_indices=None, fig.tight_layout() fig.canvas.draw() except Exception as e: - print "Could not invoke tight layout: {}".format(e) + print("Could not invoke tight layout: {}".format(e)) pass if updates: try: ax.figure.canvas.show() except Exception as e: - print "Could not invoke show: {}".format(e) + print("Could not invoke show: {}".format(e)) raw_input('Enter to continue') view.deactivate() return ax diff --git a/GPy/plotting/matplot_dep/inference_plots.py b/GPy/plotting/matplot_dep/inference_plots.py index c802932c..02007390 100644 --- a/GPy/plotting/matplot_dep/inference_plots.py +++ b/GPy/plotting/matplot_dep/inference_plots.py @@ -12,7 +12,7 @@ except: def plot_optimizer(optimizer): if optimizer.trace == None: - print "No trace present so I can't plot it. Please check that the optimizer actually supplies a trace." + print("No trace present so I can't plot it. Please check that the optimizer actually supplies a trace.") else: pb.figure() pb.plot(optimizer.trace) diff --git a/GPy/plotting/matplot_dep/kernel_plots.py b/GPy/plotting/matplot_dep/kernel_plots.py index 347e3d08..fc061ca7 100644 --- a/GPy/plotting/matplot_dep/kernel_plots.py +++ b/GPy/plotting/matplot_dep/kernel_plots.py @@ -81,7 +81,7 @@ def plot_ARD(kernel, fignum=None, ax=None, title='', legend=False, filtering=Non last_bottom = ard_params[i,:] bottom += last_bottom else: - print "filtering out {}".format(kernel.parameters[i].name) + print("filtering out {}".format(kernel.parameters[i].name)) ax.set_xlim(-.5, kernel.input_dim - .5) add_bar_labels(fig, ax, [bars[-1]], bottom=bottom-last_bottom) diff --git a/GPy/plotting/matplot_dep/maps.py b/GPy/plotting/matplot_dep/maps.py index fcb03b38..65cecd30 100644 --- a/GPy/plotting/matplot_dep/maps.py +++ b/GPy/plotting/matplot_dep/maps.py @@ -159,10 +159,10 @@ def new_shape_string(sf,name,regex,field=2,type=None): newshp.line(parts=_parts) newshp.records.append(sr.record) - print len(sr.record) + print(len(sr.record)) newshp.save(name) - print index + print(index) def apply_bbox(sf,ax): """ diff --git a/GPy/plotting/matplot_dep/visualize.py b/GPy/plotting/matplot_dep/visualize.py index 9ff41730..50eb4b82 100644 --- a/GPy/plotting/matplot_dep/visualize.py +++ b/GPy/plotting/matplot_dep/visualize.py @@ -225,8 +225,8 @@ class lvm_dimselect(lvm): self.labels = labels lvm.__init__(self,vals,model,data_visualize,latent_axes,sense_axes,latent_index) self.show_sensitivities() - print self.latent_values - print "use left and right mouse buttons to select dimensions" + print(self.latent_values) + print("use left and right mouse buttons to select dimensions") def on_click(self, event): @@ -255,7 +255,7 @@ class lvm_dimselect(lvm): def on_leave(self,event): - print type(self.latent_values) + print(type(self.latent_values)) latent_values = self.latent_values.copy() y = self.model.predict(latent_values[None,:])[0] self.data_visualize.modify(y)