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

**BREAKING**: makes GP evaluation explicitly require RowVecs/ColVecs wrapper; calling GP with AbstractMatrix now errors #260

Closed
wants to merge 20 commits into from

Conversation

st--
Copy link
Member

@st-- st-- commented Jan 19, 2022

Resolves #257

src/finite_gp_projection.jl Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jan 19, 2022

Codecov Report

Merging #260 (f740a97) into master (ff3874f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #260   +/-   ##
=======================================
  Coverage   97.88%   97.89%           
=======================================
  Files          10       10           
  Lines         379      380    +1     
=======================================
+ Hits          371      372    +1     
  Misses          8        8           
Impacted Files Coverage Δ
src/finite_gp_projection.jl 100.00% <100.00%> (ø)
src/sparse_approximations.jl 100.00% <100.00%> (ø)

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 ff3874f...f740a97. Read the comment docs.

st-- and others added 4 commits January 19, 2022 14:37
@st--
Copy link
Member Author

st-- commented Jan 19, 2022

Somehow the docs preview doesn't seem to reflect the changes.

The PPL test failure is unrelated (Turing/libtask_jll version incompatiblities).

src/finite_gp_projection.jl Outdated Show resolved Hide resolved
src/finite_gp_projection.jl Outdated Show resolved Hide resolved
st-- and others added 3 commits January 20, 2022 18:19
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@st-- st-- changed the title Improve UX when passing matrix to GP evaluation without explicit RowVecs/ColVecs wrapper **BREAKING**: makes GP evaluation explicitly require RowVecs/ColVecs wrapper; calling GP with AbstractMatrix now errors Jan 20, 2022
Copy link
Member

@willtebbutt willtebbutt left a comment

Choose a reason for hiding this comment

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

A couple of thoughts

docs/src/api.md Outdated Show resolved Hide resolved
src/finite_gp_projection.jl Outdated Show resolved Hide resolved
@willtebbutt
Copy link
Member

Oo, also -- could you add a small @test_throws test somewhere, to help ensure that we don't accidentally remove the informative error message at some point in the future?

@willtebbutt
Copy link
Member

I'm happy with this now, but I would like @devmotion to approve, as he's been quite involved in the review of this PR.

Copy link
Member

@devmotion devmotion left a comment

Choose a reason for hiding this comment

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

I think the PR is not completely ready yet but it's definitely better to decide and state clearly that matrices are not supported instead of allowing them but still printing a log message.

I have the following questions:

  • Was there agreement that matrices should not be allowed in KernelFunctions either (I would be fine with it but I know that @theogf wanted to support matrices in the past)? I think this PR should only be merged after the behaviour in KernelFunctions is changed, and it should not be merged at all if we want to continue supporting matrices in KernelFunctions. It seems you also link to the documentation of KernelFunctions in the docstring but currently this documentation explains why matrices are supported: https://juliagaussianprocesses.github.io/KernelFunctions.jl/stable/design/#Why-We-Have-Support-for-Both
  • Have you considered deprecating the constructor (possibly with a custom deprecation message) and removing it in the next breaking release instead of throwing an error? Throwing an error demands a breaking release but in this case we could just remove the constructor directly.
  • Have you considered handling the matrices in (f::AbstractGP)(x...) instead of (or in addition) to the FiniteGP constructor? f(x...) seems to be the official API and hence it is a bit surprising to only error in an internal method - but to refer to f(x...) in the error message.

@@ -1,26 +1,6 @@
# Features

## Plotting
Copy link
Member

Choose a reason for hiding this comment

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

These changes seem unrelated, would have been cleaner to make them in a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

true. just done that

@theogf
Copy link
Member

theogf commented Jan 20, 2022

Was there agreement that matrices should not be allowed in KernelFunctions either (I would be fine with it but I know that @theogf wanted to support matrices in the past)? I think this PR should only be merged after the behaviour in KernelFunctions is changed, and it should not be merged at all if we want to continue supporting matrices in KernelFunctions.

I don't care anymore if we support matrices or not in KernelFunctions. I think this is a useful feature, but if we want to remove it it's fine. However, I disagree with the order of deprecation. We should deprecate AbstractGPs first as it has zero impact on KernelFunctions.jl. KF is still a very distinct part of the whole ecosystem anyway

@devmotion
Copy link
Member

We should deprecate AbstractGPs first as it has zero impact on KernelFunctions.jl. KF is still a very distinct part of the whole ecosystem anyway

It's distinct but in both cases currently one can use ColVecs etc and matrices, so dropping support for matrices in only one of the packages is inconsistent. Both are part of the GP ecosystem and KernelFunctions defines and explains ColVecs etc. IMO the inconsistency becomes really apparent by the fact that the KernelFunctions docs - which are linked from the docstring in this PR - explicitly explain why matrices are supported as well.

As a middle ground, we could just remove the default value for obsdim (I mentioned this in a thread above). Eg Distances did the same, and this would avoid any confusion and implicit assumptions about whether rows or columns are observations.

@st-- st-- mentioned this pull request Jan 27, 2022
@devmotion
Copy link
Member

devmotion commented Jan 31, 2022

I think this PR should not be merged in light of the (soon to be merged) obsdim changes in KernelFunctions. Instead I think it would be more consistent to require an explicit obsdim argument as well for matrices.

@devmotion
Copy link
Member

#264 was merged, so I think this PR can be closed.

@st-- st-- closed this Mar 21, 2022
@st-- st-- deleted the st/matrix_info branch March 21, 2022 09:08
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.

GP's call should not accept matrix (without RowVecs/ColVecs)
4 participants