sqfa.statistics
Functions to compute class statistics of labeled data points.
Functions
|
Compute the mean, covariance and second moment matrix of each class. |
|
Compute the OAS covariance matrix of the given points. |
|
Compute the principal components of the given points. |
|
Compute the principal components of the given scatter matrices. |
|
Compute the sample covariance matrix of the given points. |
- sqfa.statistics.class_statistics(points, labels, estimator='empirical')
Compute the mean, covariance and second moment matrix of each class.
- Parameters:
points (torch.Tensor) – Data points with shape (n_points, n_dim).
labels (torch.Tensor) – Class labels of each point with shape (n_points).
estimator – Covariance estimator to use. Options are “empirical” and “oas”. Default is “empirical”.
- Returns:
statistics_dict – Dictionary containing the mean, covariance and second moment matrix of each class.
- Return type:
dict
- sqfa.statistics.oas_covariance(points, assume_centered=False)
Compute the OAS covariance matrix of the given points.
- Parameters:
points (torch.Tensor) – Data points with shape (n_points, n_dim).
- Returns:
oas_covariance – OAS covariance matrix of the points.
- Return type:
torch.Tensor
References
- sqfa.statistics.pca(points, n_components=None)
Compute the principal components of the given points.
- Parameters:
points (torch.Tensor) – Data points with shape (n_points, n_dim).
n_components (int) – Number of principal components to compute. Default is min(n_points, n_dim).
- Returns:
components – Principal components of the points. (n_components, n_dim)
- Return type:
torch.Tensor
- sqfa.statistics.pca_from_scatter(scatters, n_components=None)
Compute the principal components of the given scatter matrices. The scatter matrices are averaged and the principal components are computed from the average scatter matrix.
- Parameters:
scatters (torch.Tensor) – Scatter matrices with shape (n_classes, n_dim, n_dim).
n_components (int) – Number of principal components to compute. Default is n_dim.
- Returns:
components – Principal components of the scatter matrices. (n_components, n_dim)
- Return type:
torch.Tensor