Skip to content

Commit

Permalink
fix elbo call in pgpr training loop which causes NxN crash
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniPasserello committed May 21, 2021
1 parent fa245d6 commit 19ca76b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
19 changes: 0 additions & 19 deletions shgp/classification/demos/demo_pgpr_vs_svgp_uci.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,6 @@
tf.random.set_seed(0)


# TODO: Run fertility metric experiment
def load_fertility():
# https://archive.ics.uci.edu/ml/datasets/Fertility
dataset = "../../data/fertility.txt"

data = np.loadtxt(dataset, delimiter=",")
X = data[:, :-1]
Y = data[:, -1].reshape(-1, 1)

NUM_INDUCING = 100 # quicker with 100 than with 9
BERN_ITERS = 500 # best with 100: -38.982949 (with 9: -38.991571)
PGPR_ITERS = (5, 25, 5) # best with 100: -39.354674
GREEDY_THRESHOLD = 1e-6 # (early stops at 9): -39.354684

return X, Y, NUM_INDUCING, BERN_ITERS, PGPR_ITERS, GREEDY_THRESHOLD


# TODO: Try fix memory errors (maybe I can run PGPR, but not svgp?)
# This is why it won't fit in memory???
def load_electricity():
# https://datahub.io/machine-learning/electricity
dataset = "../../data/electricity.csv"
Expand Down
2 changes: 1 addition & 1 deletion shgp/utilities/train_pgpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _train_sparse_reinit_pgpr(model, inner_iters, opt_iters, ci_iters, M, reinit
For example: greedy_variance() or h_greedy_variance().
"""
opt = gpflow.optimizers.Scipy()
prev_elbo, elbos = model.elbo(), []
prev_elbo, elbos = -float("inf"), []
outer_iters = reinit_metadata.outer_iters

return_metrics = X_test is not None
Expand Down

0 comments on commit 19ca76b

Please sign in to comment.