Skip to content

Commit

Permalink
Merge pull request #1073 from SheffieldML/1056-test-with-python-2-sty…
Browse files Browse the repository at this point in the history
…le-print-statements

remove python2-styled print statements
  • Loading branch information
MartinBubel authored May 29, 2024
2 parents 623ff17 + 22ca662 commit 2932e9d
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 124 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

* remove python2-style print statements (#1056)

* update import in `.plotting.matplot_dep.defaults` due to change in matplotlib

* Correct dl_dm term in student t inference #1065
Expand Down
8 changes: 4 additions & 4 deletions GPy/testing/deactivated/deactivated_test_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ def test_BayesianGPLVM_MPI(self):
m = GPy.models.BayesianGPLVM(data.T,1,mpi_comm=comm)
m.optimize(max_iters=10)
if comm.rank==0:
print float(m.objective_function())
print(float(m.objective_function()))
m.inference_method.mpi_comm=None
m.mpi_comm=None
m._trigger_params_changed()
print float(m.objective_function())
print(float(m.objective_function()))
"""
with open("mpi_test__.py", "w") as f:
f.write(code)
Expand Down Expand Up @@ -59,11 +59,11 @@ def test_SparseGPRegression_MPI(self):
m = GPy.models.SparseGPRegression(data[:1].T,data[1:2].T,mpi_comm=comm)
m.optimize(max_iters=10)
if comm.rank==0:
print float(m.objective_function())
print(float(m.objective_function()))
m.inference_method.mpi_comm=None
m.mpi_comm=None
m._trigger_params_changed()
print float(m.objective_function())
print(float(m.objective_function()))
"""
with open("mpi_test__.py", "w") as f:
f.write(code)
Expand Down
21 changes: 10 additions & 11 deletions GPy/testing/mpi_test__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@

import numpy as np
import GPy
from mpi4py import MPI

np.random.seed(123456)
comm = MPI.COMM_WORLD
N = 100
x = np.linspace(-6., 6., N)
x = np.linspace(-6.0, 6.0, N)
y = np.sin(x) + np.random.randn(N) * 0.05
comm.Bcast(y)
data = np.vstack([x,y])
#infr = GPy.inference.latent_function_inference.VarDTC_minibatch(mpi_comm=comm)
m = GPy.models.SparseGPRegression(data[:1].T,data[1:2].T,mpi_comm=comm)
data = np.vstack([x, y])
# infr = GPy.inference.latent_function_inference.VarDTC_minibatch(mpi_comm=comm)
m = GPy.models.SparseGPRegression(data[:1].T, data[1:2].T, mpi_comm=comm)
m.optimize(max_iters=10)
if comm.rank==0:
print float(m.objective_function())
m.inference_method.mpi_comm=None
m.mpi_comm=None
if comm.rank == 0:
print(float(m.objective_function()))
m.inference_method.mpi_comm = None
m.mpi_comm = None
m._trigger_params_changed()
print float(m.objective_function())

print(float(m.objective_function()))
Loading

0 comments on commit 2932e9d

Please sign in to comment.