From c950267a4dbd66733dccec5b15d6ec0ba39c91e7 Mon Sep 17 00:00:00 2001
From: "Pavel N. Krivitsky"
Date: Fri, 31 May 2024 16:21:57 +1000
Subject: [PATCH] L_BGNN() now normalises the matrix by the harmonic mean of
the marginals as before.
---
MCRS_GAT.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/MCRS_GAT.py b/MCRS_GAT.py
index 977a0cc..f015a86 100644
--- a/MCRS_GAT.py
+++ b/MCRS_GAT.py
@@ -61,9 +61,8 @@ def L_BGNN(file_path, criteria, user_id_map, item_id_map):
# Calculate vector of degrees
margins = np.maximum(np.sum(adj_matrix, axis=0), 1.0)
- # TODO: Check if using sqrt(margins) would be better here.
- # Normalise the matrix using the degrees
- normalized_matrix = adj_matrix / margins[:, None] / margins[None, :]
+ # Divide the matrix by the harmonic mean of its margins.
+ normalized_matrix = (adj_matrix / margins[:, None] + adj_matrix / margins[None, :]) / 2
matrices.append(normalized_matrix)