def main(): clsf = OpenAttack.load("Victim.BiLSTM.SST") dataset = OpenAttack.load("Dataset.SST.sample")[:10] attacker = OpenAttack.attackers.GeneticAttacker() attack_eval = CustomAttackEval(attacker, clsf) attack_eval.eval(dataset, visualize=True)
def main(): # load Dataset.SST.sample for evaluation dataset = OpenAttack.load("Dataset.SST.sample")[:10] # choose the costomized classifier as the victim classification model clsf = MyClassifier() # choose PWWS as the attacker and initialize it with default parameters attacker = OpenAttack.attackers.PWWSAttacker() # prepare for attacking attack_eval = OpenAttack.attack_evals.DefaultAttackEval(attacker, clsf) # launch attacks and print attack results attack_eval.eval(dataset, visualize=True)