Skip to content
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

Conjugate Gradient Lower Bound #1706

Merged
merged 40 commits into from
Sep 2, 2021
Merged

Conjugate Gradient Lower Bound #1706

merged 40 commits into from
Sep 2, 2021

Conversation

awav
Copy link
Member

@awav awav commented Aug 20, 2021

CGLB [1] has a tighter bound and better hyperparameter estimation comparing to SGPR model. Implementation-wise the difference between SGPR and CGLB is an extra code for the conjugate gradient, which is quite simple. The original implementation can be found at [2].

[1] https://arxiv.org/abs/2102.08314v1
[2] https://github.com/awav/CGLB

TODO list:

  • Add docstrings to key methods and classes
  • Notebook
  • Tests
    • Conjugate gradient converges
    • Set v = 0 and recover the quadratic term from SGPR
    • Replace CG with another solver for K v = y

@DavidBurt2

@awav awav requested a review from vdutor August 20, 2021 14:33
gpflow/models/sgpr.py Outdated Show resolved Hide resolved
gpflow/models/sgpr.py Outdated Show resolved Hide resolved
gpflow/models/cglb.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 22, 2021

Codecov Report

Merging #1706 (79ea5ad) into develop (348c75d) will decrease coverage by 0.02%.
The diff coverage is 96.82%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1706      +/-   ##
===========================================
- Coverage    97.00%   96.97%   -0.03%     
===========================================
  Files           91       92       +1     
  Lines         4168     4336     +168     
===========================================
+ Hits          4043     4205     +162     
- Misses         125      131       +6     
Impacted Files Coverage Δ
gpflow/models/cglb.py 95.71% <95.71%> (ø)
gpflow/models/__init__.py 100.00% <100.00%> (ø)
gpflow/models/sgpr.py 98.83% <100.00%> (+0.21%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 348c75d...79ea5ad. Read the comment docs.

st-- added a commit that referenced this pull request Aug 27, 2021
@st-- st-- mentioned this pull request Aug 27, 2021
st-- added a commit that referenced this pull request Aug 27, 2021
Copy link
Contributor

@vdutor vdutor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - left some questions and general feedback to improve code quality

doc/source/notebooks/theory/cglb.pct.py Outdated Show resolved Hide resolved
doc/source/notebooks/theory/cglb.pct.py Outdated Show resolved Hide resolved
k = 100
xnew = np.linspace(x.min() - 1.0, x.max() + 1.0, k).reshape(-1, 1)

pred_no_tol = cglb.predict_y(xnew, cg_tolerance=None)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean no tolerance or cached tolerance, which I believe to be 1?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that no conjugate gradient will be run.

The cached value of self.aux_vec will be used. If self.aux_vec=0, e.g. when the model is initialized, prediction will match SGPR. This is what is currently in the docstring for predict_f:

cg_tolerance: float or None: If None, the cached value of :math:v is used. If float, conjugate gradient is run until :math:rᵀQ⁻¹r < ϵ.
Any suggestions on things we could do to make this clearer? Would it be useful to add this description to the notebook?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidBurt2, we should just re-state the same in the notebook.

doc/source/notebooks/theory/cglb.pct.py Outdated Show resolved Hide resolved
doc/source/notebooks/theory/cglb.pct.py Outdated Show resolved Hide resolved
gpflow/models/cglb.py Outdated Show resolved Hide resolved
gpflow/models/cglb.py Outdated Show resolved Hide resolved
gpflow/models/cglb.py Outdated Show resolved Hide resolved
gpflow/models/sgpr.py Outdated Show resolved Hide resolved
gpflow/models/sgpr.py Outdated Show resolved Hide resolved
awav and others added 4 commits August 31, 2021 15:02
Co-authored-by: Vincent Dutordoir <dutordoirv@gmail.com>
Co-authored-by: Vincent Dutordoir <dutordoirv@gmail.com>
@awav awav merged commit 49a8cd8 into develop Sep 2, 2021
@awav awav deleted the awav/cglb branch September 2, 2021 14:27
@awav awav mentioned this pull request Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants