8d3f66f01a4decd1b240a8e6fa2af4abfd7d25d1,art/attacks/evasion/carlini.py,CarliniLInfMethod,__init__,#CarliniLInfMethod#Any#Any#Any#Any#Any#Any#Any#Any#Any#,620

Before Change


        :param batch_size: Size of the batch on which adversarial samples are generated.
        
        super(CarliniLInfMethod, self).__init__(classifier)
        if not isinstance(classifier, ClassifierGradients):
            raise ClassifierError(self.__class__, [ClassifierGradients], classifier)

        kwargs = {
            "confidence": confidence,
            "targeted": targeted,
            "learning_rate": learning_rate,
            "max_iter": max_iter,
            "max_halving": max_halving,
            "max_doubling": max_doubling,
            "eps": eps,
            "batch_size": batch_size,
        }
        assert self.set_params(**kwargs)

        // There is one internal hyperparameter:
        // Smooth arguments of arctanh by multiplying with this constant to avoid division by zero:
        self._tanh_smoother = 0.999999

After Change


    ]

    def __init__(
        self,
        classifier: ClassifierGradients,
        confidence: float = 0.0,
        targeted: bool = False,
        learning_rate: float = 0.01,
        max_iter: int = 10,
        max_halving: int = 5,
        max_doubling: int = 5,
        eps: float = 0.3,
        batch_size: int = 128,
    ) -> None:
        
        Create a Carlini L_Inf attack instance.

        :param classifier: A trained classifier.
        :param confidence: Confidence of adversarial examples: a higher value produces examples that are farther away,
                from the original input, but classified with higher confidence as the target class.
        :param targeted: Should the attack target one specific class.
        :param learning_rate: The initial learning rate for the attack algorithm. Smaller values produce better
                results but are slower to converge.
        :param max_iter: The maximum number of iterations.
        :param max_halving: Maximum number of halving steps in the line search optimization.
        :param max_doubling: Maximum number of doubling steps in the line search optimization.
        :param eps: An upper bound for the L_0 norm of the adversarial perturbation.
        :param batch_size: Size of the batch on which adversarial samples are generated.
        
        super(CarliniLInfMethod, self).__init__(classifier)

        self.confidence = confidence
        self.targeted = targeted
        self.learning_rate = learning_rate
        self.max_iter = max_iter
        self.max_halving = max_halving
        self.max_doubling = max_doubling
        self.eps = eps
        self.batch_size = batch_size
        self._check_params()

        // There is one internal hyperparameter:
        // Smooth arguments of arctanh by multiplying with this constant to avoid division by zero:
        self._tanh_smoother = 0.999999
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 27

Instances


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 8d3f66f01a4decd1b240a8e6fa2af4abfd7d25d1
Time: 2020-05-10
Author: irinutza.n@gmail.com
File Name: art/attacks/evasion/carlini.py
Class Name: CarliniLInfMethod
Method Name: __init__


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 8d3f66f01a4decd1b240a8e6fa2af4abfd7d25d1
Time: 2020-05-10
Author: irinutza.n@gmail.com
File Name: art/attacks/evasion/elastic_net.py
Class Name: ElasticNet
Method Name: __init__


Project Name: IBM/adversarial-robustness-toolbox
Commit Name: 8d3f66f01a4decd1b240a8e6fa2af4abfd7d25d1
Time: 2020-05-10
Author: irinutza.n@gmail.com
File Name: art/attacks/evasion/carlini.py
Class Name: CarliniL2Method
Method Name: __init__