@@ -107,47 +107,50 @@ const AttackManager = (function() {
107
107
const config = {
108
108
type : attackType ,
109
109
poisonedNodePercent : parseFloat ( document . getElementById ( "poisoned-node-percent" ) . value ) ,
110
- startRound : parseInt ( document . getElementById ( "start-attack" ) . value ) ,
111
- stopRound : parseInt ( document . getElementById ( "stop-attack" ) . value ) ,
112
- attackInterval : parseInt ( document . getElementById ( "attack-interval" ) . value )
110
+ round_start_attack : parseInt ( document . getElementById ( "start-attack" ) . value ) ,
111
+ round_stop_attack : parseInt ( document . getElementById ( "stop-attack" ) . value ) ,
112
+ attack_interval : parseInt ( document . getElementById ( "attack-interval" ) . value )
113
113
} ;
114
114
115
115
switch ( attackType ) {
116
116
case ATTACK_TYPES . LABEL_FLIPPING :
117
- config . poisonedSamplePercent = parseFloat ( document . getElementById ( "poisoned-sample-percent" ) . value ) ;
117
+ config . poisoned_percent = parseFloat ( document . getElementById ( "poisoned-sample-percent" ) . value ) ;
118
118
config . targeted = document . getElementById ( "targeted" ) . checked ;
119
119
if ( config . targeted ) {
120
- config . targetLabel = parseInt ( document . getElementById ( "target_label" ) . value ) ;
121
- config . targetChangedLabel = parseInt ( document . getElementById ( "target_changed_label" ) . value ) ;
120
+ config . target_label = parseInt ( document . getElementById ( "target_label" ) . value ) ;
121
+ config . target_changed_label = parseInt ( document . getElementById ( "target_changed_label" ) . value ) ;
122
122
}
123
123
break ;
124
124
125
125
case ATTACK_TYPES . SAMPLE_POISONING :
126
- config . poisonedSamplePercent = parseFloat ( document . getElementById ( "poisoned-sample-percent" ) . value ) ;
127
- config . poisonedNoisePercent = parseFloat ( document . getElementById ( "poisoned-noise-percent" ) . value ) ;
128
- config . noiseType = document . getElementById ( "noise_type" ) . value ;
126
+ config . poisoned_percent = parseFloat ( document . getElementById ( "poisoned-sample-percent" ) . value ) ;
127
+ config . poisoned_ratio = parseFloat ( document . getElementById ( "poisoned-noise-percent" ) . value ) ;
128
+ config . noise_type = document . getElementById ( "noise_type" ) . value ;
129
129
config . targeted = document . getElementById ( "targeted" ) . checked ;
130
+ if ( config . targeted ) {
131
+ config . target_label = parseInt ( document . getElementById ( "target_label" ) . value ) ;
132
+ }
130
133
break ;
131
134
132
135
case ATTACK_TYPES . MODEL_POISONING :
133
- config . poisonedNoisePercent = parseFloat ( document . getElementById ( "poisoned-noise-percent" ) . value ) ;
134
- config . noiseType = document . getElementById ( "noise_type" ) . value ;
136
+ config . poisoned_ratio = parseFloat ( document . getElementById ( "poisoned-noise-percent" ) . value ) ;
137
+ config . noise_type = document . getElementById ( "noise_type" ) . value ;
135
138
break ;
136
139
137
140
case ATTACK_TYPES . SWAPPING_WEIGHTS :
138
- config . layerIdx = parseInt ( document . getElementById ( "layer_idx" ) . value ) ;
141
+ config . layer_idx = parseInt ( document . getElementById ( "layer_idx" ) . value ) ;
139
142
break ;
140
143
141
144
case ATTACK_TYPES . DELAYER :
142
145
config . delay = parseInt ( document . getElementById ( "delay" ) . value ) ;
143
- config . targetPercentage = parseFloat ( document . getElementById ( "target-percentage" ) . value ) ;
144
- config . selectionInterval = parseInt ( document . getElementById ( "selection-interval" ) . value ) ;
146
+ config . target_percentage = parseInt ( document . getElementById ( "target-percentage" ) . value ) ;
147
+ config . selection_interval = parseInt ( document . getElementById ( "selection-interval" ) . value ) ;
145
148
break ;
146
149
147
150
case ATTACK_TYPES . FLOODING :
148
- config . floodingFactor = parseInt ( document . getElementById ( "flooding-factor" ) . value ) ;
149
- config . targetPercentage = parseFloat ( document . getElementById ( "target-percentage" ) . value ) ;
150
- config . selectionInterval = parseInt ( document . getElementById ( "selection-interval" ) . value ) ;
151
+ config . flooding_factor = parseInt ( document . getElementById ( "flooding-factor" ) . value ) ;
152
+ config . target_percentage = parseInt ( document . getElementById ( "target-percentage" ) . value ) ;
153
+ config . selection_interval = parseInt ( document . getElementById ( "selection-interval" ) . value ) ;
151
154
break ;
152
155
}
153
156
@@ -163,47 +166,50 @@ const AttackManager = (function() {
163
166
164
167
// Set common fields
165
168
document . getElementById ( "poisoned-node-percent" ) . value = config . poisonedNodePercent || 0 ;
166
- document . getElementById ( "start-attack" ) . value = config . startRound || 1 ;
167
- document . getElementById ( "stop-attack" ) . value = config . stopRound || 10 ;
168
- document . getElementById ( "attack-interval" ) . value = config . attackInterval || 1 ;
169
+ document . getElementById ( "start-attack" ) . value = config . round_start_attack || 1 ;
170
+ document . getElementById ( "stop-attack" ) . value = config . round_stop_attack || 10 ;
171
+ document . getElementById ( "attack-interval" ) . value = config . attack_interval || 1 ;
169
172
170
173
// Set attack-specific fields
171
174
switch ( config . type ) {
172
175
case ATTACK_TYPES . LABEL_FLIPPING :
173
- document . getElementById ( "poisoned-sample-percent" ) . value = config . poisonedSamplePercent || 0 ;
176
+ document . getElementById ( "poisoned-sample-percent" ) . value = config . poisoned_percent || 0 ;
174
177
document . getElementById ( "targeted" ) . checked = config . targeted || false ;
175
178
if ( config . targeted ) {
176
- document . getElementById ( "target_label" ) . value = config . targetLabel || 4 ;
177
- document . getElementById ( "target_changed_label" ) . value = config . targetChangedLabel || 7 ;
179
+ document . getElementById ( "target_label" ) . value = config . target_label || 4 ;
180
+ document . getElementById ( "target_changed_label" ) . value = config . target_changed_label || 7 ;
178
181
}
179
182
break ;
180
183
181
184
case ATTACK_TYPES . SAMPLE_POISONING :
182
- document . getElementById ( "poisoned-sample-percent" ) . value = config . poisonedSamplePercent || 0 ;
183
- document . getElementById ( "poisoned-noise-percent" ) . value = config . poisonedNoisePercent || 0 ;
184
- document . getElementById ( "noise_type" ) . value = config . noiseType || "Salt" ;
185
+ document . getElementById ( "poisoned-sample-percent" ) . value = config . poisoned_percent || 0 ;
186
+ document . getElementById ( "poisoned-noise-percent" ) . value = config . poisoned_ratio || 0 ;
187
+ document . getElementById ( "noise_type" ) . value = config . noise_type || "Salt" ;
185
188
document . getElementById ( "targeted" ) . checked = config . targeted || false ;
189
+ if ( config . targeted ) {
190
+ document . getElementById ( "target_label" ) . value = config . target_label || 4 ;
191
+ }
186
192
break ;
187
193
188
194
case ATTACK_TYPES . MODEL_POISONING :
189
- document . getElementById ( "poisoned-noise-percent" ) . value = config . poisonedNoisePercent || 0 ;
190
- document . getElementById ( "noise_type" ) . value = config . noiseType || "Salt" ;
195
+ document . getElementById ( "poisoned-noise-percent" ) . value = config . poisoned_ratio || 0 ;
196
+ document . getElementById ( "noise_type" ) . value = config . noise_type || "Salt" ;
191
197
break ;
192
198
193
199
case ATTACK_TYPES . SWAPPING_WEIGHTS :
194
- document . getElementById ( "layer_idx" ) . value = config . layerIdx || 0 ;
200
+ document . getElementById ( "layer_idx" ) . value = config . layer_idx || 0 ;
195
201
break ;
196
202
197
203
case ATTACK_TYPES . DELAYER :
198
204
document . getElementById ( "delay" ) . value = config . delay || 10 ;
199
- document . getElementById ( "target-percentage" ) . value = config . targetPercentage || 100 ;
200
- document . getElementById ( "selection-interval" ) . value = config . selectionInterval || 1 ;
205
+ document . getElementById ( "target-percentage" ) . value = config . target_percentage || 100 ;
206
+ document . getElementById ( "selection-interval" ) . value = config . selection_interval || 1 ;
201
207
break ;
202
208
203
209
case ATTACK_TYPES . FLOODING :
204
- document . getElementById ( "flooding-factor" ) . value = config . floodingFactor || 100 ;
205
- document . getElementById ( "target-percentage" ) . value = config . targetPercentage || 100 ;
206
- document . getElementById ( "selection-interval" ) . value = config . selectionInterval || 1 ;
210
+ document . getElementById ( "flooding-factor" ) . value = config . flooding_factor || 100 ;
211
+ document . getElementById ( "target-percentage" ) . value = config . target_percentage || 100 ;
212
+ document . getElementById ( "selection-interval" ) . value = config . selection_interval || 1 ;
207
213
break ;
208
214
}
209
215
}
0 commit comments