class_docstr: Class for performing refutations on graph and storing the results
docstr: Method to test conditional independence using the graph refutation object on the given testing set
  
  :param independence_constraints: List of implications to test the conditional independence on
  :returns : GraphRefutation object
docstr_tok: ["Method","to","test","conditional","independence","using","the","graph","refutation","object","on","the","given","testing","set",":","param","independence_constraints",":","List","of","implications","to","test","the","conditional","independence","on",":","returns",":","GraphRefutation","object"]
code: def refute_model(self, independence_constraints):
      """
      Method to test conditional independence using the graph refutation object on the given testing set
  
      :param independence_constraints: List of implications to test the conditional independence on
      :returns : GraphRefutation object
      """
  
      refute = GraphRefutation(
          method_name_continuous=self._method_name_continuous,
          method_name_discrete=self._method_name_discrete,
      )
  
      all_nodes = list(self._data.columns.values)
      discrete_columns = []
      continuous_columns = []
      binary_columns = []
      variable_type = dict()
      for node in all_nodes:
          if (
              self._data[node].dtype == np.int64
              or self._data[node].dtype == np.int32
          ):
              discrete_columns.append(node)
              variable_type[node] = "discrete"
              if self._data[node].isin([0, 1]).all():
                  binary_columns.append(node)
                  variable_type[node] = "binary"
          else:
              continuous_columns.append(node)
              variable_type[node] = "continuous"
      for a, b, c in independence_constraints:
          if (
              a in continuous_columns
              and b in continuous_columns
              and all(node in continuous_columns for node in c)
          ):
              # a, b and c are all continuous variables
              if (
                  self._method_name_continuous is None
                  or self._method_name_continuous
                  == "partial_correlation"
              ):
                  self.partial_correlation(x=a, y=b, z=c)
              else:
                  self.logger.error(
                      "Invalid conditional independence test for continuous data. Supported tests - partial_correlation"
                  )
  
          elif (
              a in discrete_columns
              and b in discrete_columns
              and all(node in discrete_columns for node in c)
          ):
              # a, b and c are all discrete variables
              if (
                  self._method_name_discrete is None
                  or self._method_name_discrete
                  == "conditional_mutual_information"
              ):
                  self.conditional_mutual_information(x=a, y=b, z=c)
              else:
                  self.logger.error(
                      "Invalid conditional independence test for discrete data. Supported tests - conditional_mutual_information"
                  )
  
          elif (
              (a in continuous_columns or a in binary_columns)
              and (b in continuous_columns or b in binary_columns)
              and all(
                  node in continuous_columns or node in binary_columns
                  for node in c
              )
          ):
              # c is set of continuous and binary variables and
              #   1. either a and b is continuous and the other is binary
              #   2. both a and b are binary
              self.partial_correlation(x=a, y=b, z=c)
  
          elif all(node in discrete_columns for node in c) and (
              a in discrete_columns or b in discrete_columns
          ):
              # c is discrete and
              # either a or b is continuous and the other is discrete
              self.conditional_mutual_information(x=a, y=b, z=c)
  
          elif a in discrete_columns and b in discrete_columns:
              # a and b are discrete and c is a mixture of discrete and continuous variables. We discretize c and calculate conditional mutual information
              self.conditional_mutual_information(x=a, y=b, z=c)
  
          else:
              key = (a, b) + (c,)
              self._results[key] = [None, "NotImplemented"]
              variable_types_c = []
              for var in c:
                  variable_types_c.append(variable_type[var])
              self.logger.warning(
                  "The following setting with {0} as {1}, {2} as {3}, {4} as {5} not supported".format(
                      a,
                      variable_type[a],
                      b,
                      variable_type[b],
                      c,
                      variable_types_c,
                  )
              )
  
      self.set_refutation_result(
          number_of_constraints_model=len(independence_constraints)
      )
      refute.add_conditional_independence_test_result(
          number_of_constraints_model=len(independence_constraints),
          number_of_constraints_satisfied=len(self._true_implications),
          refutation_result=self._refutation_passed,
      )
      return refute
  
file_path: dowhy/dowhy/causal_refuters/graph_refuter.py
imports: import logging
  import numpy
  from dowhy.causal_refuter import CausalRefutation, CausalRefuter
  from dowhy.utils.cit import conditional_MI, partial_corr
label_desc: Use image node_id 5 for calling the GraphRefuter obj's underlying member method code with example usage: obj.refute_model(independence_constraints) and returns: refute