class_docstr: Test behaviour of the roc_auc_states metric
docstr: AUC should still be calculated correctly with states missing in test set
docstr_tok: ["AUC","should","still","be","calculated","correctly","with","states","missing","in","test","set"]
code: def test_auc_with_missing_state_in_test(self):
      """AUC should still be calculated correctly with states missing in test set"""
  
      # equal class (c) weighting to guarantee high ROC expected
      train = pd.DataFrame(
          [
              [a, b, 0]
              for a in range(0, 2)
              for b in range(0, 2)
              for _ in range(1)
          ]
          + [
              [a, b, 1]
              for a in range(0, 2)
              for b in range(0, 2)
              for _ in range(a * 10 + b * 10 + 1000)
          ]
          + [
              [a, b, 0]
              for a in range(2, 4)
              for b in range(2, 4)
              for _ in range(a * 10 + b * 10 + 1000)
          ]
          + [
              [a, b, 1]
              for a in range(2, 4)
              for b in range(2, 4)
              for _ in range(1)
          ],
          columns=["a", "b", "c"],
      )
  
      test = train[train["c"] == 1]
      assert len(test["c"].unique()) == 1
  
      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)
  
      _, auc = roc_auc(bn, test, "c")
      assert math.isclose(auc, 1, abs_tol=0.01)
  
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 7 for calling the TestROCAUCStates obj's underlying member method code with example usage: obj.test_auc_with_missing_state_in_test() without return types