skshapes.features.Moments
- class skshapes.features.Moments(points, neighborhoods, method='cosine')
Bases:
object
- __init__(points, neighborhoods, method='cosine')
Methods
__init__
(points, neighborhoods[, method])covariance_axes
covariance_eigenvalues
covariance_eigenvalues_eigenvectors
covariance_eigenvectors
covariances
masses
means
tensors
(*, order, central)- tensors(*, order, central)
- Return type:
Float32[Tensor, 'n_points *channels']
Examples
import skshapes as sks # Create a 3-dimensional shape with 100 points shape = sks.Sphere().resample(n_points=100) # Consider the local moments at scale 0.5 moments = shape.point_moments(scale=0.5) # Compute local masses mom_0 = moments.tensors(order=0, central=False) print(mom_0.shape, mom_0.dtype)
...torch.Size([100]) torch.float32
# Compute local average positions mom_1 = moments.tensors(order=1, central=False) print(mom_1.shape, mom_1.dtype)
...torch.Size([100, 3]) torch.float32
# Compute local covariance matrices mom_2 = moments.tensors(order=2, central=True) print(mom_2.shape, mom_2.dtype)
...torch.Size([100, 3, 3]) torch.float32