Repository navigation
ENH: add MarginalGP model and fixes in covariance functions API - #309
tirthasheshpatel wants to merge 20 commits into
Conversation
|
I have completed my work on the model and now tests and a notebook is left. Can one of you take a look at this please @fonnesbeck @aloctavodia All the doctests are passing but I cannot get NUTS to run on this, unfortunately. |
|
What's the issue with NUTS? |
Codecov Report
@@ Coverage Diff @@
## master #309 +/- ##
==========================================
- Coverage 90.89% 90.38% -0.51%
==========================================
Files 36 36
Lines 2822 2903 +81
==========================================
+ Hits 2565 2624 +59
- Misses 257 279 +22
|
@fonnesbeck Never seen this before. But I will try to debug it |
|
Turns out this happened due to the choice of poor priors and kernels. I solved it by adding a white noise kernel. So NUTS now works (just have to add a lot of noise for float32 data type which is not very good). |
|
Marking this ready for reviews. Will add tests and notebook asap |
|
Yeah, the TFP Gaussian processes have default jitter, which can be customized as an argument to the constructor. I wonder if we should do similarly. |
|
I have already added the jitter argument that defaults to 1e-4 for float32
and 1e-6 for float64 datatype and works in a similar way as TFP.
…On Sat, Aug 1, 2020, 1:41 AM Chris Fonnesbeck ***@***.***> wrote:
Yeah, the TFP Gaussian processes have default jitter, which can be
customized as an argument to the constructor. I wonder if we should do
similarly.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#309 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKJOJRBDOCU3B6TZ6ULSI3LR6MQQDANCNFSM4PQHBW6Q>
.
|
|
I have added the notebook but the inference is really difficult. Tried both full rank ADVI and NUTS but still not able to get good results. I will play around with it more... meanwhile accepting some reviews on the notebook @AlexAndorra @bwengals (there may be loads of typos since I did this in a hurry. 😅) |
AlexAndorra
left a comment
There was a problem hiding this comment.
This looks nice, thanks @tirthasheshpatel ! I left comments below for the NB. Also remember to style according to the PyMC NB style guide 😉
This is a big PR, so I'll also welcome the other guys' comments, especially on the code implementation and tests.
| @@ -0,0 +1,381 @@ | |||
| { | |||
There was a problem hiding this comment.
- A Marginal Gaussian process jointly represent
ings the data as a large probability distribution - making it easy to infer a distrbution over the test data for prediction and generation.
- Maybe explain why adding noise is necessary and useful
Reply via ReviewNB
| @@ -0,0 +1,381 @@ | |||
| { | |||
There was a problem hiding this comment.
MareginalGPMarginal GP Model- It contains the
marginal_likelihoodandconditionalmethods, that doesexactlyaswhat's described in the previous section. Moreover, it also has the methodspredictandpredicttto... - sample from the conditional distribution and to get point estimate ... of the conditional distribution respectively: I think a word is missing at the end, otherwise the "respectively" isn't needed, as we're only talking about the conditional distribution.
- Let's see each method in detail in the following sections
- #Now, we can
instantiatainstantiate the model - "As
noisebehaves exactly asjitter, it is recommended to setjitter=Falseto avoid adding extra noise": Is itjitter=Falseorjitter=0(you talk about both above)? - I would explain more about how passing a covariance object as noise to the
marginal_likelihoodmethod is different than just passing a scalar. I'd also explain more what kind of statistical objectmarginal_likelihoodis returning conceptually. This would also shed light about cases whereyis not the observed data. - ... and
y_predis a realization of a multivariate normal distribution. - The
givendictionary is optional when themarginal_likelihoodmethod has been called before. - "To add noise in the conditional distribution, use": here also, it would be helpful to explain why adding noise is useful
- "To avoid reparametrizing to the
MvNormalCholeskydistribution, use": it would be helpful to explain why the Cholesky decomposition is useful and used by default under the hood
Reply via ReviewNB
| @@ -0,0 +1,381 @@ | |||
| { | |||
There was a problem hiding this comment.
| @@ -0,0 +1,381 @@ | |||
| { | |||
There was a problem hiding this comment.
Have you tried with more informative priors? Like Exponential(1) or HalfNormal instead of HalfCauchy(5) for positive parameters? And more informative Gamma parameters?
I think these priors are quite wide, and the number of data points is quite low, which could explain why sampling is difficult
Reply via ReviewNB
There was a problem hiding this comment.
The priors don't have to be very informative, but it is helpful if they are bounded away from zero somewhat (and away from very large values).
|
I never liked the name |
|
Its because it is based on the marginal likelihood. I'd hesitate to use |
|
@fonnesbeck Well I understand that but I don't think it makes sense from a user perspective who doesn't know the underlying math of GPs. Not married to |
|
@twiecki I see your general point regarding hiding unnecessary technical jargon from the user, but here its pretty important that the user does recognize that the marginal likelihood is required, because in the next line they will be calling |
|
Running |
|
does changing the line |
|
Maybe related to tensorflow/tensorflow#30120 and tensorflow/tensorflow#33154. Mostly seems like a compatibility issue |
|
Got it running by adding the amplitude as an argument, as you suggested. I cannot get a good fit for this model, either using mean-field or full-rank ADVI. The fit wants to make the noise parameter very large, which results in the poor fit. Even constraining sigma to be pretty small does not work; it eventually breaks when you make it too small, as it is no longer able to invert the matrix. |
|
@fonnesbeck That's the problem I am facing too!! Is there a way to create variables inside the function decorated with When I put variables in the model, pm.sample and pm.fit gives me the following error: Full traceback |
I have not investigated this :( For now I think it is quite problematic and should be separately researched in TensorFlow documentation. |
|
@ferrine I don't know why the model currently implemented doesn't work. But I experimented with GP-LVM with the help of @Sayam753 and got very good results. So, I think the Here are the results of a GP-LVM model: @fonnesbeck Should we temporarily change the example in the notebook to GP-LVM model? |
|
Anyways, I have added the GP-LVM example in the notebook. Thanks @AlexAndorra for the reviews. Have made the changes accordingly. Feel free to inform me if I missed something... |
tirthasheshpatel
left a comment
There was a problem hiding this comment.
Hello, all. I am back on this. Any more reviews on this?
|
This all looks good to me, unless @bwengals has any concerns before we merge. I will test it on a couple simple models I am currently working with. |
|
I don't understand the test failures. Is that a temporary glitch or something has changed? |

MarginalGPmodel.