Skip to content

Instantly share code, notes, and snippets.

@mihirkhandekar
Last active April 7, 2020 12:26
Show Gist options
  • Save mihirkhandekar/07d13e5db8039b8190ed7f485f551fc5 to your computer and use it in GitHub Desktop.
Save mihirkhandekar/07d13e5db8039b8190ed7f485f551fc5 to your computer and use it in GitHub Desktop.
# Load the classification model by passing the model, that
# you'd like to train, in `model` argument
advreg_wrapper.load_classification(model=cmodel,
optimizer="adam",
learning_rate=0.001)
advreg_wrapper.load_inference(optimizer="adam", learning_rate=0.0001)
# begins training in an adversarial manner (with defense if _lambda > 0)
advreg_wrapper.begin_advreg_training(datahandler=datahandler,
_lambda=3,
regloss="mse",
device="cpu",
epochs_wo_defense=1,
epochs_w_defense=49,#49,
iterations_wo_defense=100,
iterations_w_defense=76,
classifier_batches=1,
attack_batches=10,
decay_learning_rate=False)
# begins testing
advreg_wrapper.begin_testing(datahandler=datahandler,
attack_data_percentage=50, training_size=20000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment