entropy
Functions:
Name | Description |
---|---|
gaussian_mixture_entropy |
Compute the entropy of a Gaussian mixture on a mini batch via Monte Carlo integration. |
square_mahalanobis_distance |
Calculate the square Mahalanobis Distance between the features of x and y given the diagonal tensor of standard deviations. |
gaussian_mixture_entropy
¶
gaussian_mixture_entropy(
clean_embeddings: Tensor,
transformed_embeddings: Tensor,
means: Tensor,
stds: Tensor,
mask: Tensor,
losses: ComponentLossesDict | None = None,
) -> torch.Tensor
Compute the entropy of a Gaussian mixture on a mini batch via Monte Carlo integration.
Note: The transformed embeddings should be a different batch than the clean embeddings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Tensor
|
The untransformed embeddings. |
required |
|
Tensor
|
The stained glass transformed embeddings. |
required |
|
Tensor
|
The means tensor. |
required |
|
Tensor
|
The standard deviations tensor. |
required |
|
Tensor
|
The mask to apply to the reduction. |
required |
|
ComponentLossesDict | None
|
The dictionary of component losses. If provided, the loss will be added to the losses dictionary. |
None
|
Returns:
Type | Description |
---|---|
torch.Tensor
|
The computed Gaussian mixture entropy. |
Warning
This API is experimental and subject to change: The entropy component of the mutual information loss is still under research.
square_mahalanobis_distance
¶
Calculate the square Mahalanobis Distance between the features of x and y given the diagonal tensor of standard deviations.
Notes
Adds a normalization factor of 0.5 to the square Mahalanobis distance calculation for the variance to align with the Gaussian distribution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Tensor
|
The first tensor. |
required |
|
Tensor
|
The second tensor. |
required |
|
Tensor
|
The tensor of standard deviations. |
required |
|
Tensor
|
The mask to apply to the reduction. |
required |
Returns:
Type | Description |
---|---|
torch.Tensor
|
The computed square Mahalanobis distance between x and y. |
Warning
This API is experimental and subject to change: The entropy component of the mutual information loss is still under research.