@@ -306,14 +306,14 @@ def _fine_grained_binary_search_local(
306306 lbd = initial_lbd
307307 # For targeted: we want to expand(x1.01) boundary away from targeted dataset
308308 # For untargeted, we want to slim(x0.99) the boundary toward the original dataset
309- if (not self ._is_label (x_0 + lbd * theta , target ) and self . targeted ) or (
310- self ._is_label (x_0 + lbd * theta , y_0 ) and not self . targeted
309+ if (self . targeted and not self ._is_label (x_0 + lbd * theta , target )) or (
310+ not self .targeted and self . _is_label (x_0 + lbd * theta , y_0 )
311311 ):
312312 lbd_lo = lbd
313313 lbd_hi = lbd * 1.01
314314 nquery += 1
315- while (not self ._is_label (x_0 + lbd_hi * theta , target ) and self . targeted ) or (
316- self ._is_label (x_0 + lbd_hi * theta , y_0 ) and not self . targeted
315+ while (self . targeted and not self ._is_label (x_0 + lbd_hi * theta , target )) or (
316+ not self .targeted and self . _is_label (x_0 + lbd_hi * theta , y_0 )
317317 ):
318318 lbd_hi = lbd_hi * 1.01
319319 nquery += 1
@@ -323,17 +323,17 @@ def _fine_grained_binary_search_local(
323323 lbd_hi = lbd
324324 lbd_lo = lbd * 0.99
325325 nquery += 1
326- while (self ._is_label (x_0 + lbd_lo * theta , target ) and self . targeted ) or (
327- not self ._is_label (x_0 + lbd_lo * theta , y_0 ) and not self . targeted
326+ while (self .targeted and self . _is_label (x_0 + lbd_lo * theta , target )) or (
327+ not self .targeted and not self . _is_label (x_0 + lbd_lo * theta , y_0 )
328328 ):
329329 lbd_lo = lbd_lo * 0.99
330330 nquery += 1
331331
332332 while (lbd_hi - lbd_lo ) > tol :
333333 lbd_mid = (lbd_lo + lbd_hi ) / 2.0
334334 nquery += 1
335- if (self ._is_label (x_0 + lbd_mid * theta , target ) and self . targeted ) or (
336- not self ._is_label (x_0 + lbd_mid * theta , y_0 ) and not self . targeted
335+ if (self .targeted and self . _is_label (x_0 + lbd_mid * theta , target )) or (
336+ not self .targeted and not self . _is_label (x_0 + lbd_mid * theta , y_0 )
337337 ):
338338 lbd_hi = lbd_mid
339339 else :
0 commit comments