class_docstr: A unittest class for testing the decision tree attack.
class_docstr_tok: ["A","unittest","class","for","testing","the","decision","tree","attack","."]
code: def test_scikitlearn(self):
      clf = DecisionTreeClassifier()
      x_original = self.X.copy()
      clf.fit(self.X, self.y)
      clf_art = SklearnClassifier(clf)
      attack = DecisionTreeAttack(clf_art, verbose=False)
      adv = attack.generate(self.X[:25])
      # all crafting should succeed
      self.assertTrue(
          np.sum(clf.predict(adv) == clf.predict(self.X[:25])) == 0
      )
      targets = np.array(
          [
              1,
              1,
              1,
              2,
              2,
              2,
              3,
              3,
              3,
              4,
              4,
              4,
              5,
              5,
              5,
              6,
              6,
              6,
              7,
              7,
              7,
              8,
              8,
              8,
              9,
          ]
      )
      adv = attack.generate(self.X[:25], targets)
      # all targeted crafting should succeed as well
      self.assertTrue(np.sum(clf.predict(adv) == targets) == 25.0)
      # Check that X has not been modified by attack and classifier
      self.assertAlmostEqual(
          float(np.max(np.abs(x_original - self.X))), 0.0, delta=0.00001
      )
  
file_path: adversarial-robustness-toolbox/tests/attacks/test_decision_tree_attack.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import unittest
  from sklearn.tree import DecisionTreeClassifier
  from sklearn.datasets import load_digits
  import numpy
  from art.attacks.evasion.decision_tree_attack import DecisionTreeAttack
  from art.estimators.classification.scikitlearn import SklearnClassifier
  from art.estimators.classification.scikitlearn import ScikitlearnDecisionTreeClassifier
  from tests.utils import TestBase, master_seed
  from tests.attacks.utils import backend_test_classifier_type_check_fail
label_desc: Use image node_id 2 for calling the TestDecisionTreeAttack obj's underlying member method code with example usage: obj.test_scikitlearn() without return types