question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Unable to estimate independent scale parameters for each input

See original GitHub issue

I have a spatio-temporal GP with three input dimensions (2 spatial coordinates plus time) and am trying to use ARD to have separate lengthscale parameters for each, as well as separate scale kernels for the spatial vs the temporal inputs. My covariance function looks like this:

self.covar_module = (
            gpytorch.kernels.ScaleKernel(
                gpytorch.kernels.MaternKernel(nu=1/2, 
                                          active_dims=torch.tensor([0, 1]), 
                                          ard_num_dims=2,
                                          batch_size=batch_size),
                active_dims=torch.tensor([0, 1]), 
                ard_num_dims=2,
                batch_size=batch_size)
            * gpytorch.kernels.ScaleKernel(
                gpytorch.kernels.RBFKernel(active_dims=torch.tensor([2]),
                                          batch_size=batch_size),
                active_dims=torch.tensor([2]),
                batch_size=batch_size))

However, when I fit the model, looking at the estimated parameters afterwards shows that the same scale is being estimated for both components:

likelihood.noise_covar.raw_noise tensor([-5.4645], device='cuda:0')
covar_module.kernels.0.raw_outputscale tensor(-3.7285, device='cuda:0')
covar_module.kernels.0.base_kernel.raw_lengthscale tensor([[2.4628, 3.4885]], device='cuda:0')
covar_module.kernels.1.raw_outputscale tensor(-3.7285, device='cuda:0')
covar_module.kernels.1.base_kernel.raw_lengthscale tensor([[3.7490]], device='cuda:0')

as having the same value to 4 decimal places seems unlikely otherwise.

Is this user error on my part, or is this a bug? Is it possible to estimate different scales for each input feature?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
fonnesbeckcommented, Jul 22, 2019

There is a somewhat confusing API issue here, however. Namely, its not clear why a kernel should be wrapped at all by ScaleKernel when it is simply pulled outside as a multiplier. In other words,

ScaleKernel(MaternKernel()) * RBFKernel()

seems superfluous when all that ends up happening is:

ScaleKernel() * MaternKernel() * RBFKernel()

Is there anything beyond this going on to the passed kernel that does not end up also being applied to the second kernel?

0reactions
fonnesbeckcommented, Jul 21, 2019

Got it, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

WinBUGS User Manual | MRC Biostatistics Unit
Tutorial. Introduction. Specifying a model in the BUGS language. Running a model in WinBUGS. Monitoring parameter values. Checking convergence.
Read more >
ArcGIS Pro 3.0 Issues Addressed - Esri
BUG-000137298 The error message, "ERROR 130051: Input feature class is not registered as versioned." is returned when attempting to execute Calculate Geometry ...
Read more >
How to use Data Scaling Improve Deep Learning Model ...
Scaling Input Variables​​ A good rule of thumb is that input variables should be small values, probably in the range of 0-1 or...
Read more >
Release notes - XDS Package
The input parameter DATA_RANGE= was ignored in the CORRECT step. Bug correction in XSCALE. The column OBSERVED reported a too small number of...
Read more >
Estimation of discrete choice models with BIOGEME 1.8
A different scale parameter will be estimated for the utility of each group. [Exclude] Define an expression (see Section [Expressions]) which ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found