Skip to content

Commit

Permalink
fix: labelflipping attack
Browse files Browse the repository at this point in the history
  • Loading branch information
FerTV committed Jan 7, 2025
1 parent ee35561 commit f61351a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions nebula/addons/attacks/poisoning/labelflipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def labelFlipping(
dataset,
indices,
poisoned_persent=0,
poisoned_percent=0,
targeted=False,
target_label=4,
target_changed_label=7,
Expand Down Expand Up @@ -56,9 +56,9 @@ def labelFlipping(
# classes = new_dataset.classes
# class_to_idx = new_dataset.class_to_idx
# class_list = [class_to_idx[i] for i in classes]
class_list = set(targets.tolist())
class_list = list(set(targets.tolist()))
if not targeted:
num_flipped = int(poisoned_persent * num_indices)
num_flipped = int(poisoned_percent * num_indices)
if num_indices == 0:
return new_dataset
if num_flipped > num_indices:
Expand Down
8 changes: 4 additions & 4 deletions nebula/frontend/templates/deployment.html
Original file line number Diff line number Diff line change
Expand Up @@ -2507,10 +2507,10 @@ <h5 class="step-title">Schema of deployment</h5>
document.getElementById("poisoned-node-title").style.display = "block";
document.getElementById("poisoned-node-percent-container").style.display = "block";
document.getElementById("poisoned-sample-percent").value = 0;
document.getElementById("poisoned-sample-title").style.display = "none";
document.getElementById("poisoned-sample-percent-container").style.display = "none";
document.getElementById("poisoned-noise-title").style.display = "block";
document.getElementById("poisoned-noise-percent-container").style.display = "block";
document.getElementById("poisoned-sample-title").style.display = "block";
document.getElementById("poisoned-sample-percent-container").style.display = "block";
document.getElementById("poisoned-noise-title").style.display = "none";
document.getElementById("poisoned-noise-percent-container").style.display = "none";
}
else if(this.value == "GLLNeuronInversionAttack" || this.value == "NoiseInjectionAttack" || this.value == "SwappingWeightsAttack" || this.value == "DelayerAttack"){
document.getElementById("poisoned-node-title").style.display = "block";
Expand Down

0 comments on commit f61351a

Please sign in to comment.