Convert print to function for Python 3 compatibility

This commit is contained in:
Mike Croucher 2015-02-26 09:01:27 +00:00
parent 4512964f09
commit 4b4e5d4901
5 changed files with 10 additions and 10 deletions

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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):
"""

View file

@ -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)