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

Spectral time kernel #256

Merged
merged 9 commits into from
Dec 16, 2024
Merged

Spectral time kernel #256

merged 9 commits into from
Dec 16, 2024

Conversation

roussel-ryan
Copy link
Collaborator

@roussel-ryan roussel-ryan commented Dec 3, 2024

  • implements a spectral mixture kernel for the time axis of time dependent model constructor, inspired by the work of @nikitakuklev
  • spectral kernel is now the default for TimeDependentModelConstructor
  • behavior can be disabled by setting use_spectral_mixture_kernel=False

)

covar_modules[name] = ProductKernel(
SpectralMixtureKernel(num_mixtures=5, active_dims=time_dim),
Copy link
Collaborator

Choose a reason for hiding this comment

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

GPyTorch recommends to initialize SMK from data. For example, from code in the paper above:

    if enable_time:
        smk = SpectralMixtureKernel(num_mixtures=num_smk_mixtures, ard_num_dims=1, active_dims=(dx.shape[-1] - 1,))
        smk.initialize_from_data(dx, dy)

        covar_module = ProductKernel(smk, regular_kernel)
        subset_batch_dict = {
            "likelihood.noise_covar.raw_noise": -2,
            "covar_module.base_kernel.kernels.1.raw_outputscale": -1,
            "covar_module.base_kernel.kernels.1.base_kernel.raw_lengthscale": -3,
        }

The subset dict part is not used by us, but initialization should be helpful. Looking at source of that heuristic, it has some statistical tests and shouldn't be a performance problem. So, maybe just do it here as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, I found 3 components a more stable choice generally.

@roussel-ryan
Copy link
Collaborator Author

@nikitakuklev thanks for your comments, lmk if these changes address them properly

Copy link
Collaborator

@nikitakuklev nikitakuklev left a comment

Choose a reason for hiding this comment

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

Good idea to leave init as choice. LGTM.

@roussel-ryan roussel-ryan merged commit b6bcd6e into main Dec 16, 2024
14 checks passed
@roussel-ryan roussel-ryan deleted the spectral_time_kernel branch December 16, 2024 22:28
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.

2 participants