-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removing dependency on setting the Keras backend #79
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,6 @@ | |
|
||
from gpflow.config import default_float | ||
|
||
tf.keras.backend.set_floatx("float64") | ||
|
||
# %% [markdown] | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,6 @@ | |
|
||
import gpflux | ||
|
||
tf.keras.backend.set_floatx("float64") | ||
|
||
|
||
class LogPrior_ELBO_SVGP(gpflow.models.SVGP): | ||
""" | ||
|
@@ -264,15 +262,15 @@ def optimization_step(): | |
|
||
|
||
@pytest.mark.parametrize( | ||
"svgp_fitter, sldgp_fitter", | ||
"svgp_fitter, sldgp_fitter, tol_kw", | ||
[ | ||
(fit_adam, fit_adam), | ||
(fit_adam, keras_fit_adam), | ||
(fit_natgrad, fit_natgrad), | ||
(fit_natgrad, keras_fit_natgrad), | ||
(fit_adam, fit_adam, {}), | ||
(fit_adam, keras_fit_adam, {}), | ||
(fit_natgrad, fit_natgrad, {}), | ||
(fit_natgrad, keras_fit_natgrad, dict(atol=1e-7)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test required lowering tolerance slightly... |
||
], | ||
) | ||
def test_svgp_equivalence_with_sldgp(svgp_fitter, sldgp_fitter, maxiter=20): | ||
def test_svgp_equivalence_with_sldgp(svgp_fitter, sldgp_fitter, tol_kw, maxiter=20): | ||
data = load_data() | ||
|
||
svgp = create_gpflow_svgp(*make_kernel_likelihood_iv()) | ||
|
@@ -281,14 +279,14 @@ def test_svgp_equivalence_with_sldgp(svgp_fitter, sldgp_fitter, maxiter=20): | |
sldgp = create_gpflux_sldgp(*make_kernel_likelihood_iv(), get_num_data(data)) | ||
sldgp_fitter(sldgp, data, maxiter=maxiter) | ||
|
||
assert_equivalence(svgp, sldgp, data) | ||
assert_equivalence(svgp, sldgp, data, **tol_kw) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"svgp_fitter, keras_fitter, tol_kw", | ||
[ | ||
(fit_adam, _keras_fit_adam, {}), | ||
(fit_natgrad, _keras_fit_natgrad, dict(atol=1e-8)), | ||
(fit_natgrad, _keras_fit_natgrad, dict(atol=1e-6)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this one as well... seems like there was an issue with this one already, so I assumed it might be ok? |
||
], | ||
) | ||
def test_svgp_equivalence_with_keras_sequential(svgp_fitter, keras_fitter, tol_kw, maxiter=10): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didnt try to run this as it needed additional packages