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.

Variational Multitask GP with correlated outputs

See original GitHub issue

Hi,

I noticed in the tutorials that you can create an exact multi-task GP with correlated outputs:

https://gpytorch.readthedocs.io/en/latest/examples/03_Multitask_Exact_GPs/Multitask_GP_Regression.html

Is it possible to do this with a variational GP? I have tried the following which doesn’t work:

class MultitaskSVGP(gpytorch.models.ApproximateGP):
    def __init__(self, inducing_points, input_dim, output_dim):
        batch_shape = torch.Size([output_dim])

        variational_distribution = CholeskyVariationalDistribution(inducing_points.size(-2), 
                                                                   batch_shape=batch_shape)

        variational_strategy = MultitaskVariationalStrategy(
                                VariationalStrategy(self, inducing_points, 
                                                   variational_distribution, 
                                                   learn_inducing_locations=True), 
                                num_tasks=output_dim)
        
        super().__init__(variational_strategy)
        
        self.mean_module = gpytorch.means.MultitaskMean(
            gpytorch.means.ConstantMean(), num_tasks=output_dim
        )
        
        self.covar_module = gpytorch.kernels.MultitaskKernel(
            gpytorch.kernels.RBFKernel(ard_num_dims=input_dim), num_tasks=output_dim, rank=1
        )

    def forward(self, x):
        mean_x = self.mean_module(x)
        covar_x = self.covar_module(x)
        return gpytorch.distributions.MultitaskMultivariateNormal(mean_x, covar_x)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gpleisscommented, Feb 4, 2020

Right - so we’re working on a feature that will add ICM and LCM-type variational multitask models. At the moment this kind of example won’t work - because the MultitaskVariationalStrategy assumes it’s getting a batch of indepenent prior GPs rather than a multi-output GP.

For now, if you try the SVGP multitask example you can learn a multi-output SVGP model. It doesn’t assume any correlations

0reactions
gpleisscommented, Jun 1, 2022

@dinithins There isn’t a straightforward way to exploit Kronecker structure for variational models. This is because - even though the prior has Kronecker structure - there isn’t any immediately obvious structure that can be assigned to the variational distribution.

The variational multitask GP implementation - which implements the linear model of coregionalization - is actually quite efficient though!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Variational GPs w/ Multiple Outputs - GPyTorch's documentation
In this example, we will demonstrate how to construct approximate/variational GPs that can model vector-valued functions (e.g. multitask/multi-output GPs).
Read more >
Collaborative Multi-output Gaussian Processes
We introduce the collaborative multi-output Gaussian process (GP) model for learning dependent tasks with very large datasets. The model fosters task  ...
Read more >
Variational Dependent Multi-output Gaussian Process ...
(2011) employed convolution processes to account for the correlations among outputs to construct a convolved multiple outputs GP (CMOGP) which can be ...
Read more >
Multi-Output - GP Model Zoo
Literature & Code for all things GP. ... Are there correlations between the outputs or independent? Is there missing data? ... Multi-Task.
Read more >
Learning Multi-Task Gaussian Process Over Heterogeneous ...
known non-parametric Bayesian model for learning correlated tasks effectively by transferring ... dependent multi-output GP has been introduced in the.
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