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

Add example for hyperparameter tuning #89

Closed
wants to merge 11 commits into from
Closed

Add example for hyperparameter tuning #89

wants to merge 11 commits into from

Conversation

simsurace
Copy link
Member

@simsurace simsurace commented May 6, 2022

This is supposed to close #76

@codecov
Copy link

codecov bot commented May 6, 2022

Codecov Report

Merging #89 (a8982da) into main (79cde8a) will decrease coverage by 21.99%.
The diff coverage is n/a.

❗ Current head a8982da differs from pull request most recent head 7938611. Consider uploading reports for the commit 7938611 to get more accurate results

@@             Coverage Diff             @@
##             main      #89       +/-   ##
===========================================
- Coverage   95.97%   73.97%   -22.00%     
===========================================
  Files          13       16        +3     
  Lines         497      661      +164     
===========================================
+ Hits          477      489       +12     
- Misses         20      172      +152     
Impacted Files Coverage Δ
src/utils.jl 63.63% <0.00%> (-36.37%) ⬇️
src/TestUtils.jl 82.53% <0.00%> (-13.16%) ⬇️
src/SpecialDistributions/ntdist.jl 95.45% <0.00%> (-4.55%) ⬇️
src/likelihoods/studentt.jl 100.00% <0.00%> (ø)
src/likelihoods/negativebinomial.jl 100.00% <0.00%> (ø)
src/SpecialDistributions/SpecialDistributions.jl 60.00% <0.00%> (ø)
src/likelihoods/categorical.jl 1.44% <0.00%> (ø)
...cialDistributions/polyagammanegativemultinomial.jl 0.00% <0.00%> (ø)
src/SpecialDistributions/negativemultinomial.jl 0.00% <0.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 79cde8a...7938611. Read the comment docs.

@theogf
Copy link
Member

theogf commented May 7, 2022

Nice thanks! If that's okay with you, could we merge #70 first and adapt this PR accordingly?

@simsurace
Copy link
Member Author

I will be making the necessary adaptations shortly.

@simsurace
Copy link
Member Author

The figure is probably not needed, but will be auto-generated by Literate, right?

Copy link
Member

@theogf theogf left a comment

Choose a reason for hiding this comment

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

My main issue is with DSVGP, I don't understand why it needs to be introduced.
It would be more interesting to see what is the difference between the model with and without hyperparameters optimized.
Also I would rather have the NonCentered appproach, it looks like it is slowly getting solved upstream!

Comment on lines 16 to 17
[compat]
GPLikelihoods = "0.4.2"
Copy link
Member

Choose a reason for hiding this comment

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

CompatHelper should do it, but it would be helpful if you already add compat for all the packages

end

# ## Diagonal SVGP model
# We define a standard diagonal sparse variational GP for comparison
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this. What is the point of having a diagonal svgp?

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you asking why a diagonal SVGP as opposed to a full SVGP, or is your question why have a SVGP in this example at all?
I simply added the SVGP example to compare to the AVGP, to see whether they would get roughly comparable results.

examples/hyperpars_nb/script.jl Outdated Show resolved Hide resolved
Comment on lines +106 to +109
M = min(30, length(l.y))
z0 = rand(M)
z0 .*= xmax - xmin
z0 .+= xmin
Copy link
Member

Choose a reason for hiding this comment

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

It's not particularly fair to compare a sparse GP with a full GP

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason why I'm interested in the augmented GP framework is to make training faster. The sparse variational GP is already much slower for moderate data sizes. If we make the variational GP use all training points, it would be hopelessly slow, wouldn't it?

end

# In order to make this work with Zygote, we had to change from
# `Centered` to `NonCentered` here. This deviates from the usual practice.
Copy link
Member

Choose a reason for hiding this comment

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

I would really rather solve the Centered approach instead of using a workaround here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, but if we merge this before those issues get resolved, we have to have a workaround.
Are there any concerns that the NonCentered representation is incorrect or less efficient?

examples/hyperpars_nb/script.jl Outdated Show resolved Hide resolved
examples/hyperpars_nb/script.jl Outdated Show resolved Hide resolved
examples/hyperpars_nb/script.jl Outdated Show resolved Hide resolved
examples/hyperpars_nb/script.jl Outdated Show resolved Hide resolved
examples/hyperpars_nb/script.jl Outdated Show resolved Hide resolved
@simsurace
Copy link
Member Author

Unfortunately after more testing it is still not working reliably. The convergence is sometimes very fast but the solution not very good.
Playing around with the data size, ground truth parameters, and random seed should reveal these problems.

@simsurace simsurace closed this by deleting the head repository Apr 27, 2023
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.

How to do hyperparameter tuning
2 participants