class_docstr: Test behaviour of the roc_auc_states metric
docstr: The AUC of incorrect predictions should be close to zero
docstr_tok: ["The","AUC","of","incorrect","predictions","should","be","close","to","zero"]
code: def test_auc_of_incorrect_close_to_zero(self):
      """The AUC of incorrect predictions should be close to zero"""
  
      # regardless of a or b, c=1 is always more likely to varying amounts (to create multiple threshold
      # points in roc curve)
      train = pd.DataFrame(
          [
              [a, b, 0]
              for a in range(3)
              for b in range(3)
              for _ in range(1)
          ]
          + [
              [a, b, 1]
              for a in range(3)
              for b in range(3)
              for _ in range(a * 1000 + b * 1000 + 1000)
          ],
          columns=["a", "b", "c"],
      )
  
      cg = StructureModel()
      cg.add_weighted_edges_from([("a", "c", 1), ("b", "c", 1)])
  
      bn = BayesianNetwork(cg)
      bn.fit_node_states(train)
      bn.fit_cpds(train)
  
      assert np.allclose(bn.cpds["c"].loc[1].values, 1, atol=0.02)
  
      # in test, c=0 is always more likely (opposite of train)
      test = pd.DataFrame(
          [
              [a, b, 0]
              for a in range(3)
              for b in range(3)
              for _ in range(1000)
          ]
          + [
              [a, b, 1]
              for a in range(3)
              for b in range(3)
              for _ in range(1)
          ],
          columns=["a", "b", "c"],
      )
  
      _, auc = roc_auc(bn, test, "c")
  
      assert math.isclose(auc, 0, abs_tol=0.001)
  
imports: import math
  import random
  import numpy
  import pandas
  from causalnex.evaluation import classification_report, roc_auc
  from causalnex.network import BayesianNetwork
  from causalnex.structure.notears import from_pandas
  from causalnex.structure.structuremodel import StructureModel
label_desc: Use image node_id 2 for calling the TestROCAUCStates obj's underlying member method code with example usage: obj.test_auc_of_incorrect_close_to_zero() without return types