Implement a prototypical 2-layer Ω distance

This commit is contained in:
julius 2023-11-03 14:51:29 +01:00
parent 391473adf3
commit 3a5a2bb473
Signed by untrusted user who does not match committer: julius
GPG Key ID: 8AA3791362A8084A

View File

@ -73,6 +73,16 @@ def omega_distance(x, y, omega):
return distances
def ML_omega_distance(x, y, omega_0, omega_1, mask_0, mask_1):
"""Multi-Layer Omega distance."""
x, y = (arr.view(arr.size(0), -1) for arr in (x, y))
omega = (omega_0 * mask_0) @ (omega_1 * mask_1)
projected_x = x @ omega
projected_y = y @ omega
distances = squared_euclidean_distance(projected_x, projected_y)
return distances
def lomega_distance(x, y, omegas):
r"""Localized Omega distance.