This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Function for implementing custom distance metrics for use in sklearn neighbor | |
| search algorithms. | |
| Here, we will use a composite product norm composed of a product of norms over | |
| given (contiguous) subsets of states. The norms over these subsets are taken | |
| to be L2 norms. | |
| If x = [s a]^T, where s and a are the contiguous subsets of x that this | |
| product norm is decomposed into, then this product norm can be written as: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """Function to compute stability metrics for covariance matrices, | |
| namely log determinants and condition numbers.""" | |
| # Use torch | |
| import torch | |
| def compute_covariance_metrics(Kxx, x_train, writer): | |
| """Helper function to compute covariance metrics. | |
| Parameters: | |
| Kxx (torch.Tensor): Tensor object corresponding to a covariance matrix. |
OlderNewer