cornellius-gp / gpytorch

A highly efficient implementation of Gaussian Processes in PyTorch
MIT License
3.56k stars 559 forks source link

Add convenience methods for getting different types of hyperparameters #380

Open jacobrgardner opened 5 years ago

jacobrgardner commented 5 years ago

It would be great if gpytorch.Module had methods for getting different specific kinds of parameters. For example, model.named_kernel_parameters() might only get parameters registered to Kernel modules.

This exists for variational parameters, but it is extremely hacky: https://github.com/cornellius-gp/gpytorch/blob/7450719cdfda2e5e00efe00cc6a13e17a03a09c5/gpytorch/module.py#L41-L44

A better solution would be to get parameters belonging to modules that are instances of VariationalDistribution or VariationalStrategy.

It might make sense for these methods to live in more specific classes than Module. For example, named_variational_parameters might live in AbstractVariationalGP, while named_kernel_parameters might live in the GP super class

gpleiss commented 5 years ago

How dare you insult my beautiful named_variational_parameters method :p

Balandat commented 5 years ago

string parsing ftw!