2. aijack.defense package#
2.1. Subpackages#
- 2.1.1. aijack.defense.crobustness package
- 2.1.2. aijack.defense.debugging package
- 2.1.3. aijack.defense.dp package
- 2.1.3.1. Subpackages
- 2.1.3.1.1. aijack.defense.dp.manager package
- 2.1.3.1.1.1. Submodules
- 2.1.3.1.1.2. aijack.defense.dp.manager.accountant module
- 2.1.3.1.1.3. aijack.defense.dp.manager.adadps module
- 2.1.3.1.1.4. aijack.defense.dp.manager.client module
- 2.1.3.1.1.5. aijack.defense.dp.manager.dataloader module
- 2.1.3.1.1.6. aijack.defense.dp.manager.dp_manager module
- 2.1.3.1.1.7. aijack.defense.dp.manager.dpoptimizer module
- 2.1.3.1.1.8. aijack.defense.dp.manager.rdp module
- 2.1.3.1.1.9. aijack.defense.dp.manager.utils module
- 2.1.3.1.1.10. Module contents
- 2.1.3.1.1. aijack.defense.dp.manager package
- 2.1.3.2. Module contents
- 2.1.3.1. Subpackages
- 2.1.4. aijack.defense.foolsgold package
- 2.1.5. aijack.defense.kanonymity package
- 2.1.6. aijack.defense.mid package
- 2.1.7. aijack.defense.paillier package
- 2.1.8. aijack.defense.soteria package
- 2.1.9. aijack.defense.sparse package
2.2. Submodules#
2.3. aijack.defense.purifier module#
- aijack.defense.purifier.PurifierLoss(prediction, pred_purified, lam=0.2, purifier_criterion=MSELoss(), accuracy_criterion=CrossEntropyLoss())[source]#
- basic loss function for purification
reference https://arxiv.org/abs/2005.03915
train purifier G against target model F to minimize the following objective function
L(G) = E[R(G(F(x)), F(x)) + λC(G(F(x), argmax F(x)))]
R is a reconstruction loss function C is a cross entropy loss function λ controls the balance of the two loss functions
- Parameters
prediction – predicted value of target model
pred_purified – purified predicted value of target model
lam – controls the balance of the following two functions
purifier_criterion – loss function to reshapre confidense score
accuracy_criterion – loss function to preserve the accuracy (C)
- Returns
weighted average of the two loss function
- Return type
loss_purifier
- class aijack.defense.purifier.Purifier_Cifar10[source]#
Bases:
torch.nn.modules.module.Module
autoencoder for purification on Cifar10 reference https://arxiv.org/abs/2005.03915
- forward(x)[source]#
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
2.4. Module contents#
Subpackage for defense algorithms for machine learning models.