[Question] Using `GPyTorch` with a distance matrix or covariance matrix as input
See original GitHub issueHi! Thanks for providing this nice tool for us!!
My question is it possible to use a symmetric pairwise distance matrix or a covariance matrix from the distance matrix as an input, instead of the conventional used X_train
? In the examples given in the documentation, we use use X_train
and y_train
and the kernel function we select will transform our X_train
into a covariance matrix. But in my case, I can only compute the distance matrix.
Any suggestions would be appreciated. Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
torch.cdist — PyTorch 1.13 documentation
Computes batched the p-norm distance between each pair of the two collections of row vectors. Parameters: x1 (Tensor) – input tensor of shape...
Read more >Pairwise similarity matrix between a set of vectors in PyTorch
A partial answer to the question, for the case of Euclidean distance/similarity (or more generally any p-norm distance), but NOT for Cosine ......
Read more >How to Compute the Pseudoinverse of a Matrix in PyTorch
linalg.pinv() method accepts a matrix and a batch of matrices as input and returns a new tensor with the pseudoinverse of the input...
Read more >How to vectorize pairwise (dis)similarity metrics | by Ben Cook
The input to that algorithm is a cost matrix where each element is the ... PyTorch and TensorFlow) is that you can use...
Read more >Mahalanobis Distance - Understanding the math with ...
What's wrong with using Euclidean Distance for Multivariate data? ... We then divide this by the covariance matrix (or multiply by the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Cool stuff. It should be possible to do this by using the components of the prediction strategies - take a look here: https://github.com/cornellius-gp/gpytorch/blob/master/gpytorch/models/exact_prediction_strategies.py#L249-L264
I have an in-house algorithm to get the distance/dissimilarity between two objects. Then I have some objects and I have computed pair-wise distances. This gives me a chance to build a covariance matrix from distance, such as a Matern kernel/covariance. I don’t have coordinates of the objects, which makes the problem a little bit hard to use build-in kernels in
gpytorch
. I don’t need a complicated kernel. I am looking for something like this inGPyTorch
, https://gist.github.com/amueller/1351047.Hope this is a little bit helpful. @Balandat