Skip to content

Commit ceeb365

Browse files
committed
Fix ShadowModel MI Attack
1 parent e7173a4 commit ceeb365

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

gnn_aid/attacks/mi_attacks.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,12 @@ def _train_attack_classifier(
232232
shadow_test_mask: torch.Tensor
233233
):
234234
"""Train attack classifier using shadow model outputs."""
235-
# Features for shadow train nodes → label 1 (member)
236235
X_train = self._extract_features(shadow_model, shadow_dataset, shadow_train_mask)
237236
y_train = np.ones(X_train.shape[0])
238237

239-
# Features for shadow test nodes → label 0 (non-member)
240238
X_test = self._extract_features(shadow_model, shadow_dataset, shadow_test_mask)
241239
y_test = np.zeros(X_test.shape[0])
242240

243-
# Combine
244241
X = np.vstack([X_train, X_test])
245242
y = np.concatenate([y_train, y_test])
246243

@@ -252,11 +249,6 @@ def _train_attack_classifier(
252249

253250
self.classifier.fit(X, y)
254251

255-
# Debug: evaluate on shadow data
256-
y_pred = self.classifier.predict(X)
257-
acc = accuracy_score(y, y_pred)
258-
print(f" ✓ Shadow attack classifier accuracy: {acc:.4f}")
259-
260252
def attack(
261253
self,
262254
model: torch.nn.Module,

0 commit comments

Comments
 (0)