-
Notifications
You must be signed in to change notification settings - Fork 6
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
Split code into submodules for the different approximations #96
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…roximateGPs.jl into st/submodules
@@ -114,7 +114,7 @@ | |||
function eval_newton_inner_loop(theta) | |||
k = with_lengthscale(Matern52Kernel(), exp(theta)) | |||
K = kernelmatrix(k, xs) | |||
f, cache = ApproximateGPs._newton_inner_loop( | |||
f, cache = LaplaceApproximationModule._newton_inner_loop( |
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.
I really like how this makes clear where the function is coming from.
Codecov Report
@@ Coverage Diff @@
## master #96 +/- ##
=======================================
Coverage 95.78% 95.78%
=======================================
Files 4 4
Lines 285 285
=======================================
Hits 273 273
Misses 12 12
Continue to review full report at Codecov.
|
Two main comments if we go in this direction:
|
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Yes, could do, but wouldn't work quite the same for
I'm not sure what you mean... ? |
I don't understand the point of having |
For the same reason we've got (In a sense we might just want them all to be their own packages, which the submodules would prepare us for later down the road, but right now it's probably not worth it.) |
Yeah but that's not the argument you raised initially. It was more about conflicting naming between methods EP and Laplace for example. But SVA is basically the common core of the package used by the rest of the methods, it's not "just another solving algorithm", that's why I would not put it in a module. My proposal would be instead to have all the core common objects in the main module and every algorithm Laplace, EP and more in their own module. |
…roximateGPs.jl into st/submodules
It was part of the argument I was trying to make! 😅
I disagree both with the premise and the conclusion... |
This comment has been minimized.
This comment has been minimized.
Sorry, I was somehow convinced that SVA was a core element and was used by everything else. Than, all you said makes sense |
docs/src/api.md
Outdated
@@ -1,5 +1,5 @@ | |||
# ApproximateGPs API | |||
|
|||
```@autodocs | |||
Modules = [ApproximateGPs] | |||
Modules = [ApproximateGPs, ApproximateGPs.API, ApproximateGPs.SparseVariationalApproximationModule, ApproximateGPs.LaplaceApproximationModule] |
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.
The only potential downside I would see is that it might look a bit weirder to see the fully-qualified names in the API docs (see https://juliagaussianprocesses.github.io/ApproximateGPs.jl/previews/PR96/api/)
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.
On the other hand, that keeps related functions next to each other, and perhaps it would actually be more helpful to have different sub-pages for each of the approximations?
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.
I really like the idea of having one page per approximation.
I wish it would just give a meaningful error message instead of just saying "error" (and not even hinting that you might want to look at warnings)... Update: I've opened an issue JuliaDocs/Documenter.jl#1756 |
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.
lgtm
Note: |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…roximateGPs.jl into st/submodules
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
One thing I don't like about this yet is that it took away all the docstrings for methods-from-other-packages (such as |
Wait you cannot access them from the REPL or from Documenter? |
From Documenter. Something about how it discovers functions? Maybe because I changed to Private = true? 🤔 It all works fine from the REPL (see tests, notebooks passing)! |
* stab at submodules * move approx_lml to API * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * clean up imports * remove unused imports * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * docfix * missing import * test: remove submodules from api docs * subpages in docs * hide private API docstrings * mention types in api/index.md * qualify * remove extra line * minor bump# * change docs/ compat * update test compat * explicitly `@reexport` to avoid exporting the submodules! * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * add likelihood imports * add import * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * add import * Update src/SparseVariationalApproximationModule.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* resolves #100 * try it out for notebooks * Update docs/literate.jl * explicit html for notebook * Update docs/literate.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * pre-1.7 compat * Update docs/literate.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * add horizontal rules at top and bottom * fix notebook/documenter link discrepancy * bugfix * fix hrules * fix markdown * fixup * fix notebook formatting * use Markdown.htmlesc * separate System information section ...... * Fix file size of notebook (#103) * Fix file size of notebook * Fix format Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Change comment Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * CompatHelper: bump compat for "GPLikelihoods" to "0.3" (#107) * CompatHelper: bump compat for "GPLikelihoods" to "0.3" * Reorder Gamma parametrization * Update project versions * Missing one Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Théo Galy-Fajou <[email protected]> * Fix outdated `literate.jl` script (#111) * Fix outdated `literate.jl` script * Fix format * Split code into submodules for the different approximations (#96) * stab at submodules * move approx_lml to API * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * clean up imports * remove unused imports * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * docfix * missing import * test: remove submodules from api docs * subpages in docs * hide private API docstrings * mention types in api/index.md * qualify * remove extra line * minor bump# * change docs/ compat * update test compat * explicitly `@reexport` to avoid exporting the submodules! * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * add likelihood imports * add import * Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * add import * Update src/SparseVariationalApproximationModule.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Rename the test files (#113) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: David Widmann <[email protected]> Co-authored-by: Théo Galy-Fajou <[email protected]> Co-authored-by: Ross Viljoen <[email protected]>
New submodules:
This does not change the exports of ApproximateGPs.jl, and hence users should not have to actually change their code.
NOTE: users of this package should only use the
export
ed symbols.Functions &c inside the submodules are liable to change, and are not part of the public interface!
Example implementation of #90. I'm actually happy with how it turned out, so changed it to "ready for review", let's continue the discussion until we find something we can all settle on:)
(Side note - ignore any of the code around
expected_loglik
, that should really move into GPLikelihoods.jl anyways.)