JuliaGaussianProcesses / Stheno.jl

Probabilistic Programming with Gaussian processes in Julia
Other
338 stars 26 forks source link

expand signature of BlockArray pullback #239

Closed RalphAS closed 1 year ago

RalphAS commented 1 year ago

This change fixes #238 by matching the signature of the standard BlockArray constructor.

RalphAS commented 1 year ago

I hope someone more familiar with the package can update the tests appropriately.

willtebbutt commented 1 year ago

Thanks for opening this @RalphAS . Would you mind providing a MWE that shows how you wound up in this situation? It will be easier to figure out how to test this given that information.

codecov[bot] commented 1 year ago

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage :thumbsup:

Coverage data is based on head (2023b63) compared to base (bd15654). Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #239 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 11 11 Lines 285 286 +1 ========================================= + Hits 285 286 +1 ``` | [Impacted Files](https://codecov.io/gh/JuliaGaussianProcesses/Stheno.jl/pull/239?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaGaussianProcesses) | Coverage Δ | | |---|---|---| | [src/affine\_transformations/cross.jl](https://codecov.io/gh/JuliaGaussianProcesses/Stheno.jl/pull/239/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaGaussianProcesses#diff-c3JjL2FmZmluZV90cmFuc2Zvcm1hdGlvbnMvY3Jvc3Muamw=) | `100.00% <100.00%> (ø)` | | | [src/input\_collection\_types.jl](https://codecov.io/gh/JuliaGaussianProcesses/Stheno.jl/pull/239/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaGaussianProcesses#diff-c3JjL2lucHV0X2NvbGxlY3Rpb25fdHlwZXMuamw=) | `100.00% <0.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaGaussianProcesses). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=JuliaGaussianProcesses)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

RalphAS commented 1 year ago

I put a small example in the issue (238). I don't know the internals well enough to reduce it further with confidence, but I surmise that logpdf handles the covariance with the UpperTriangular U property of a Cholesky object.

willtebbutt commented 1 year ago

Sorry for taking ages to look at this.

I think this basically fixes the problem, but it would be great if you could replace this block of tests with something like this:

@timedtestset "BlockMatrix" begin
    @timedtestset "Array cotangent" begin
        Ps = [3, 4, 5]
        Qs = [6, 7, 8, 9]
        X = BlockArray(randn(sum(Ps), sum(Qs)), Ps, Qs).blocks
        Ȳ = randn(sum(Ps), sum(Qs))
        adjoint_test(Stheno._collect ∘ Stheno._mortar, Ȳ, X)
    end
    @timedtestset "UpperTriangular cotangent" begin
        Ps = [3, 4, 5]
        X = BlockArray(randn(sum(Ps), sum(Ps)), Ps, Ps).blocks
        Ȳ = UpperTriangular(randn(sum(Ps), sum(Ps)))
        adjoint_test(Stheno._collect ∘ Stheno._mortar, Ȳ, X)
    end
end

so that we have a test that fails under the current implementation.

willtebbutt commented 1 year ago

Closed by #243