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

use only() instead of first() #403

Merged
merged 7 commits into from
Dec 20, 2021
Merged

use only() instead of first() #403

merged 7 commits into from
Dec 20, 2021

Conversation

st--
Copy link
Member

@st-- st-- commented Nov 9, 2021

…for 1-"vectors" that were for the benefit of Flux.

#397 (comment) says this only works for Julia 1.4+, but we already depend on the Compat package, which backports only.

This has the advantage that it a) makes clearer which parameters are actually scalar and b) until #397 is ready to be merged, adds additional error-checking.

@devmotion
Copy link
Member

#397 would remove basically all these occurrences of first. I am bit worried that this PR introduces many merge conflicts.

@theogf
Copy link
Member

theogf commented Nov 9, 2021

I would also be in favor of moving #397 forward, this looks like a lot of unnecessary overlapping

@codecov
Copy link

codecov bot commented Nov 9, 2021

Codecov Report

Merging #403 (27bffad) into master (2d17212) will increase coverage by 0.00%.
The diff coverage is 91.42%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #403   +/-   ##
=======================================
  Coverage   92.73%   92.74%           
=======================================
  Files          52       52           
  Lines        1198     1199    +1     
=======================================
+ Hits         1111     1112    +1     
  Misses         87       87           
Impacted Files Coverage Δ
src/kernels/scaledkernel.jl 88.23% <50.00%> (ø)
src/transform/periodic_transform.jl 50.00% <50.00%> (ø)
src/basekernels/constant.jl 100.00% <100.00%> (ø)
src/basekernels/exponential.jl 100.00% <100.00%> (ø)
src/basekernels/fbm.jl 100.00% <100.00%> (ø)
src/basekernels/matern.jl 100.00% <100.00%> (ø)
src/basekernels/polynomial.jl 100.00% <100.00%> (ø)
src/basekernels/rational.jl 100.00% <100.00%> (ø)
src/distances/sinus.jl 81.81% <100.00%> (+1.81%) ⬆️
src/kernels/transformedkernel.jl 72.72% <100.00%> (ø)
... and 2 more

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 2d17212...27bffad. Read the comment docs.

@st--
Copy link
Member Author

st-- commented Nov 9, 2021

I prepared this because it seemed like #397 might take rather longer to be ready for merge as it's still WIP, and this one could be merged right away (assuming I didn't miss anything and the tests pass).
I'm happy to fix all the merge conflicts for you (by making a subbranch off dw/scalar_parameterhandling and cleaning up the merge of either this branch or master in there), if you like?

@st--
Copy link
Member Author

st-- commented Nov 9, 2021

@st--
Copy link
Member Author

st-- commented Nov 9, 2021

Just to clarify, I'm still in favour of moving #397 forward. I just think this would be a neat improvement in the meantime, without impeding #397.

@devmotion
Copy link
Member

Even if the PR takes some weeks until it is merged (hopefully it doesn't, there's not much to implement and fix, mainly some discussions about the design), I don't think it's useful to introduce these merge conflicts. This PR doesn't seem to fix any bugs or pressing issues, so I think it's not worth the additional time and effort that someone has to spend.

@devmotion
Copy link
Member

In fact I've already fixed your merge conflicts here:

I appreciate this but I would like to keep the git history in the PR clean. I know you spent time on this but I really don't see the need for this PR given that the other one will be merged reasonably soon and it does not fix any issues (also most/all vectors are constructed internally).

@st--
Copy link
Member Author

st-- commented Nov 9, 2021

I don't think it's useful to introduce these merge conflicts. This PR doesn't seem to fix any bugs or pressing issues, so I think it's not worth the additional time and effort that someone has to spend.

Well, it's something that's been bugging me for a long time, and I would consider it a bug that the following runs, instead of erroring:

julia> k = with_lengthscale(SqExponentialKernel(), [2, 3])
Squared Exponential Kernel (metric = Distances.Euclidean(0.0))
	- ARD Transform (dims: 2)

julia> k(4., 2.)
0.6065306597126334

whereas it errors on this branch.

I agree it's not really worth spending lots of time arguing back and forth, but I don't think there's any time involved in fixing any merge conflicts. I've already done so in a branch, and I'm happy to update the branch to make sure master merges cleanly into your future branch without any effort on your side! You can just do git checkout --ours -- anyways.

I appreciate this but I would like to keep the git history in the PR clean.

Could you help me gain a better understanding of a) what would be "unclean" by merging master into your branch and b) what value you get out of avoiding that merge ?

@st--
Copy link
Member Author

st-- commented Nov 19, 2021

@devmotion @willtebbutt bump

@devmotion
Copy link
Member

I still don't think it's necessary and that the disadvantages (such as merge conflicts - BTW not only in the PR discussed above but also eg in the show PR) outweigh potential improvements which won't be needed anyway in the not-to-distant future.

@st--
Copy link
Member Author

st-- commented Nov 22, 2021

Could you make "not-too-distant future" a bit more precise ? And I'd still like to understand where you see the disadvantages - re merge conflicts, as I said before, I don't think it's a big hassle and I already volunteered to sort them all out for you...

@st-- st-- merged commit 05fe340 into master Dec 20, 2021
@st-- st-- deleted the st/only branch December 20, 2021 22:49
Crown421 added a commit that referenced this pull request Jan 28, 2022
commit f9bbd84
Author: st-- <[email protected]>
Date:   Fri Jan 28 09:11:50 2022 +0100

    make nystrom work with AbstractVector (#427)

    * make nystrom work with AbstractVector

    * add test

    * Update test/approximations/nystrom.jl

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * patch bump

    * Update test/approximations/nystrom.jl

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * Apply suggestions from code review

    Co-authored-by: David Widmann <[email protected]>

    * Apply suggestions from code review

    * deprecate

    * Apply suggestions from code review

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * Apply suggestions from code review

    Co-authored-by: David Widmann <[email protected]>

    * Apply suggestions from code review

    Co-authored-by: Théo Galy-Fajou <[email protected]>

    * Update src/approximations/nystrom.jl

    Co-authored-by: Théo Galy-Fajou <[email protected]>

    * Update src/approximations/nystrom.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>
    Co-authored-by: David Widmann <[email protected]>
    Co-authored-by: Théo Galy-Fajou <[email protected]>

commit d1c68a9
Author: st-- <[email protected]>
Date:   Thu Jan 13 22:33:43 2022 +0100

    fix Distances compat (#423)

    * CompatHelper: bump compat for Distances to 0.10 for package test, (keep existing compat)

    * try out Theo's fix

    * fix test compat

    * use ForwardDiff for chain rule test of SqMahalanobis

    * test on 1.4 instead of 1.3 - see if the chainrules test passes there

    * revert version branch

    * revert to 1.3

    * test_broken for older Julia versions

    Co-authored-by: CompatHelper Julia <[email protected]>

commit 93d33c2
Author: st-- <[email protected]>
Date:   Wed Jan 12 14:11:14 2022 +0100

    fix figure & cleanup (#422)

    * fix figure & cleanup

    * bump LIBSVM compat & Manifest

    * improve writing, replaces #321

commit 40cb59e
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Wed Jan 12 09:39:01 2022 +0200

    CompatHelper: bump compat for Kronecker to 0.5 for package docs, (keep existing compat) (#367)

    * CompatHelper: bump compat for Kronecker to 0.5 for package docs, (keep existing compat)

    * ] up

    Co-authored-by: CompatHelper Julia <[email protected]>
    Co-authored-by: st-- <[email protected]>

commit 7204529
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Tue Jan 11 18:37:23 2022 +0200

    CompatHelper: bump compat for Kronecker to 0.5 for package test, (keep existing compat) (#366)

    Co-authored-by: CompatHelper Julia <[email protected]>
    Co-authored-by: st-- <[email protected]>

commit 924925d
Author: st-- <[email protected]>
Date:   Tue Jan 11 16:26:02 2022 +0100

    switch SVM example to half-moon dataset (#421)

commit 992b665
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Fri Dec 24 12:18:56 2021 +0200

    CompatHelper: bump compat for SpecialFunctions to 2 for package test, (keep existing compat) (#412)

    Co-authored-by: CompatHelper Julia <[email protected]>
    Co-authored-by: Théo Galy-Fajou <[email protected]>
    Co-authored-by: st-- <[email protected]>

commit 04fa7f7
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Thu Dec 23 13:33:59 2021 +0200

    CompatHelper: bump compat for SpecialFunctions to 2, (keep existing compat) (#411)

    Co-authored-by: CompatHelper Julia <[email protected]>
    Co-authored-by: Théo Galy-Fajou <[email protected]>
    Co-authored-by: st-- <[email protected]>

commit c0fc3e1
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Thu Dec 23 01:10:40 2021 +0200

    CompatHelper: add new compat entry for Compat at version 3 for package test, (keep existing compat) (#418)

    Co-authored-by: CompatHelper Julia <[email protected]>

commit 05fe340
Author: st-- <[email protected]>
Date:   Tue Dec 21 00:49:37 2021 +0200

    use only() instead of first() (#403)

    * use only() instead of first() for 1-"vectors" that were for the benefit of Flux

    * fix one test that should not have worked as it was

    * add missing scalar Sinus constructor

commit 2d17212
Author: st-- <[email protected]>
Date:   Sat Dec 18 23:43:30 2021 +0200

    Zygote AD failure workarounds & test cleanup (#414)

    Zygote AD failures:

    * revert #409 (test_utils workaround for broken Zygote - now working again)

    * disable broken Zygote AD test for ChainTransform

    Improved tests:

    * finer-grained testsets

    * add missing test cases to test_AD

    * replace test_FiniteDiff with test_AD(..., :FiniteDiff, ...)

    * remove code duplication

commit 3c49949
Author: Théo Galy-Fajou <[email protected]>
Date:   Wed Nov 24 18:32:19 2021 +0100

    Fix typo in valid_inputs error (#408)

    * Fix typo in valid_inputs error

    * Update src/utils.jl

    Co-authored-by: David Widmann <[email protected]>

    Co-authored-by: David Widmann <[email protected]>

commit 9955044
Author: st-- <[email protected]>
Date:   Wed Nov 24 18:55:18 2021 +0200

    Fix for Zygote 0.6.30 breaking our tests (#409)

    * restrict Zygote to <0.6.30

    * revert Zygote test restriction and add finer-grained testset

    * Update test/utils.jl

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * revert testset

    * mark test_broken

    * Use `@test_throws` instead of `@test_broken`

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    Co-authored-by: David Widmann <[email protected]>

commit 33d64d1
Author: Théo Galy-Fajou <[email protected]>
Date:   Thu Nov 4 14:23:57 2021 +0100

    Add benchmarking CI (#399)

    * Add benchmark file

    * delete old benchmarks

    * Add github action

    * Add Project

    * Apply suggestions from code review

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * Missing end of line

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

commit 360ce10
Author: David Widmann <[email protected]>
Date:   Tue Nov 2 11:09:58 2021 +0100

    Update docstring of `GibbsKernel` (#395)
st-- added a commit that referenced this pull request Mar 21, 2022
* initial version of training kernel parameters example from st/examples (#234)

* update script

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix out-of-domain initial value

* initial version of training kernel parameters example from st/examples (#234)

* update script

* Apply suggestions from code review

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix out-of-domain initial value

* Add ParameterHandling

* Extend example

* Failed attempts with default Flux opt

* Add Flux.destructure example

* Add some nothing

* Squashed commit of the following:

commit f9bbd84
Author: st-- <[email protected]>
Date:   Fri Jan 28 09:11:50 2022 +0100

    make nystrom work with AbstractVector (#427)

    * make nystrom work with AbstractVector

    * add test

    * Update test/approximations/nystrom.jl

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * patch bump

    * Update test/approximations/nystrom.jl

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * Apply suggestions from code review

    Co-authored-by: David Widmann <[email protected]>

    * Apply suggestions from code review

    * deprecate

    * Apply suggestions from code review

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * Apply suggestions from code review

    Co-authored-by: David Widmann <[email protected]>

    * Apply suggestions from code review

    Co-authored-by: Théo Galy-Fajou <[email protected]>

    * Update src/approximations/nystrom.jl

    Co-authored-by: Théo Galy-Fajou <[email protected]>

    * Update src/approximations/nystrom.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>
    Co-authored-by: David Widmann <[email protected]>
    Co-authored-by: Théo Galy-Fajou <[email protected]>

commit d1c68a9
Author: st-- <[email protected]>
Date:   Thu Jan 13 22:33:43 2022 +0100

    fix Distances compat (#423)

    * CompatHelper: bump compat for Distances to 0.10 for package test, (keep existing compat)

    * try out Theo's fix

    * fix test compat

    * use ForwardDiff for chain rule test of SqMahalanobis

    * test on 1.4 instead of 1.3 - see if the chainrules test passes there

    * revert version branch

    * revert to 1.3

    * test_broken for older Julia versions

    Co-authored-by: CompatHelper Julia <[email protected]>

commit 93d33c2
Author: st-- <[email protected]>
Date:   Wed Jan 12 14:11:14 2022 +0100

    fix figure & cleanup (#422)

    * fix figure & cleanup

    * bump LIBSVM compat & Manifest

    * improve writing, replaces #321

commit 40cb59e
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Wed Jan 12 09:39:01 2022 +0200

    CompatHelper: bump compat for Kronecker to 0.5 for package docs, (keep existing compat) (#367)

    * CompatHelper: bump compat for Kronecker to 0.5 for package docs, (keep existing compat)

    * ] up

    Co-authored-by: CompatHelper Julia <[email protected]>
    Co-authored-by: st-- <[email protected]>

commit 7204529
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Tue Jan 11 18:37:23 2022 +0200

    CompatHelper: bump compat for Kronecker to 0.5 for package test, (keep existing compat) (#366)

    Co-authored-by: CompatHelper Julia <[email protected]>
    Co-authored-by: st-- <[email protected]>

commit 924925d
Author: st-- <[email protected]>
Date:   Tue Jan 11 16:26:02 2022 +0100

    switch SVM example to half-moon dataset (#421)

commit 992b665
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Fri Dec 24 12:18:56 2021 +0200

    CompatHelper: bump compat for SpecialFunctions to 2 for package test, (keep existing compat) (#412)

    Co-authored-by: CompatHelper Julia <[email protected]>
    Co-authored-by: Théo Galy-Fajou <[email protected]>
    Co-authored-by: st-- <[email protected]>

commit 04fa7f7
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Thu Dec 23 13:33:59 2021 +0200

    CompatHelper: bump compat for SpecialFunctions to 2, (keep existing compat) (#411)

    Co-authored-by: CompatHelper Julia <[email protected]>
    Co-authored-by: Théo Galy-Fajou <[email protected]>
    Co-authored-by: st-- <[email protected]>

commit c0fc3e1
Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Date:   Thu Dec 23 01:10:40 2021 +0200

    CompatHelper: add new compat entry for Compat at version 3 for package test, (keep existing compat) (#418)

    Co-authored-by: CompatHelper Julia <[email protected]>

commit 05fe340
Author: st-- <[email protected]>
Date:   Tue Dec 21 00:49:37 2021 +0200

    use only() instead of first() (#403)

    * use only() instead of first() for 1-"vectors" that were for the benefit of Flux

    * fix one test that should not have worked as it was

    * add missing scalar Sinus constructor

commit 2d17212
Author: st-- <[email protected]>
Date:   Sat Dec 18 23:43:30 2021 +0200

    Zygote AD failure workarounds & test cleanup (#414)

    Zygote AD failures:

    * revert #409 (test_utils workaround for broken Zygote - now working again)

    * disable broken Zygote AD test for ChainTransform

    Improved tests:

    * finer-grained testsets

    * add missing test cases to test_AD

    * replace test_FiniteDiff with test_AD(..., :FiniteDiff, ...)

    * remove code duplication

commit 3c49949
Author: Théo Galy-Fajou <[email protected]>
Date:   Wed Nov 24 18:32:19 2021 +0100

    Fix typo in valid_inputs error (#408)

    * Fix typo in valid_inputs error

    * Update src/utils.jl

    Co-authored-by: David Widmann <[email protected]>

    Co-authored-by: David Widmann <[email protected]>

commit 9955044
Author: st-- <[email protected]>
Date:   Wed Nov 24 18:55:18 2021 +0200

    Fix for Zygote 0.6.30 breaking our tests (#409)

    * restrict Zygote to <0.6.30

    * revert Zygote test restriction and add finer-grained testset

    * Update test/utils.jl

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * revert testset

    * mark test_broken

    * Use `@test_throws` instead of `@test_broken`

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
    Co-authored-by: David Widmann <[email protected]>

commit 33d64d1
Author: Théo Galy-Fajou <[email protected]>
Date:   Thu Nov 4 14:23:57 2021 +0100

    Add benchmarking CI (#399)

    * Add benchmark file

    * delete old benchmarks

    * Add github action

    * Add Project

    * Apply suggestions from code review

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

    * Missing end of line

    Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

commit 360ce10
Author: David Widmann <[email protected]>
Date:   Tue Nov 2 11:09:58 2021 +0100

    Update docstring of `GibbsKernel` (#395)

* change title

* Update manifest

* Formatter

* Some small updates

* Add BenchmarkTools

* Move Benchmarks to the correct manifest

* Formatter

* Fix missed comment

* Add ParameterHandling too

* Change gif embed

* Forgot #

* Formatter

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Compat and gif kwargs

* , for ;

* different commit msg

* Some more clarification

* Change display

* Final changes

* Apply suggestions from code review

Co-authored-by: st-- <[email protected]>

* Apply suggestions from code review

Co-authored-by: st-- <[email protected]>

* Address comments

* Missed one

* Manifest issue

* Apply suggestions from formatter

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Local formatter

* Delete loss description.

Co-authored-by: st-- <[email protected]>

* format

Co-authored-by: ST John <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants