-
This is a follow up to #1646, where @Balandat gave me some very helpful advice that allowed me to fit models successfully. Now that I'm able to fit models successfully, the next step is to get really great fits :-) As before, I'm using the sklearn Mauna Loa example as a baseline to help me sanity check things as I go. What I'm finding now is that, though I'm able to reproduce sklearn outputs almost identically with gpytorch when I specify equivalent kernels and do no additional training (see this gist), when I initialize identical kernels in sklearn and gpytorch and try then try to optimize them, gpytorch I get substantially worse fits than I get with the Since this is from the same initialization and with the same noise level, my next step was to check the optimizer -- I'd been following the standard gpytorch examples that use Adam, but sklearn uses LBFGS by default, so I tried dropping in gpytorch's LBFGS optimzer based on the example here. Also, the sklearn example offers a pre-optimzed kernel specification as a point of departure, so I tried optimizing starting both from that kernel (which I think should represent a pretty good initialization) and from an unoptimized default kernel (which I specified to have the same initial parameters for both gpytorch and sklearn. Starting from those kernels, I found: preoptimized kernel
default kernel
I have a notebook at this gist that shows what I've tried. (Note that to run it you'll need to adjust the Many thanks for any advice anyone may have of what to try next, or pointers about things I'm doing wrong or have overlooked! :-) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
Any ideas from anyone? I bet I'm missing something that would be obvious to someone who has worked with Gpytorch a lot, but that has not occurred to me to try yet. Suggestions would be most appreciated! Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thanks @Balandat! I was not aware of botorch, and I suspect that even if I'd known of it, never in a million years would I have thought to try swapping out LBFGS implementations, so thank you for your expertise and insight! :-) Using In case it may be useful to anyone finding this thread in the future here's a complete notebook that uses gpytorch to more or less reproduce the sklearn Mauna Loa example. |
Beta Was this translation helpful? Give feedback.
Thanks @Balandat! I was not aware of botorch, and I suspect that even if I'd known of it, never in a million years would I have thought to try swapping out LBFGS implementations, so thank you for your expertise and insight! :-) Using
botorch.fit_gpytorch_model
was indeed the missing piece.In case it may be useful to anyone finding this thread in the future here's a complete notebook that uses gpytorch to more or less reproduce the sklearn Mauna Loa example.