class_docstr: This is an inference class for performing Causal Inference over Bayesian
  Networks or Structural Equation Models.
  
  Parameters
  ----------
  model: pgmpy.base.DAG | pgmpy.models.BayesianNetwork
      The model that we'll perform inference over.
  
  set_nodes: list[node:str] or None
      A list (or set/tuple) of nodes in the Bayesian Network which have been
      set to a specific value per the do-operator.
  
  Examples
  --------
  Create a small Bayesian Network.
  
  >>> from pgmpy.models import BayesianNetwork
  >>> game = BayesianNetwork([('X', 'A'),
  ...                         ('A', 'Y'),
  ...                         ('A', 'B')])
  
  Load the graph into the CausalInference object to make causal queries.
  
  >>> from pgmpy.inference.CausalInference import CausalInference
  >>> inference = CausalInference(game)
  >>> inference.get_all_backdoor_adjustment_sets(X="X", Y="Y")
  >>> inference.get_all_frontdoor_adjustment_sets(X="X", Y="Y")
  
  References
  ----------
  'Causality: Models, Reasoning, and Inference' - Judea Pearl (2000)
class_docstr_tok: ["This","is","an","inference","class","for","performing","Causal","Inference","over","Bayesian","Networks","or","Structural","Equation","Models",".","Parameters","--","--","--","--","--","model",":","pgmpy.base.DAG","|","pgmpy.models.BayesianNetwork","The","model","that","we","'ll","perform","inference","over",".","set_nodes",":","list","[","node",":","str","]","or","None","A","list","(","or","set\/tuple",")","of","nodes","in","the","Bayesian","Network","which","have","been","set","to","a","specific","value","per","the","do-operator",".","Examples","--","--","--","--","Create","a","small","Bayesian","Network",".",">",">",">","from","pgmpy.models","import","BayesianNetwork",">",">",">","game","=","BayesianNetwork","(","[","(","'","X","'",",","'","A","'",")",",","...","(","'","A","'",",","'","Y","'",")",",","...","(","'","A","'",",","'","B","'",")","]",")","Load","the","graph","into","the","CausalInference","object","to","make","causal","queries",".",">",">",">","from","pgmpy.inference.CausalInference","import","CausalInference",">",">",">","inference","=","CausalInference","(","game",")",">",">",">","inference.get_all_backdoor_adjustment_sets","(","X=","''","X","''",",","Y=","''","Y","''",")",">",">",">","inference.get_all_frontdoor_adjustment_sets","(","X=","''","X","''",",","Y=","''","Y","''",")","References","--","--","--","--","--","'Causality",":","Models",",","Reasoning",",","and","Inference","'","-","Judea","Pearl","(","2000",")"]
docstr: Test whether Z is a valid frontdoor adjustment set for estimating the causal impact of X on Y via the frontdoor
  adjustment formula.
  
  Parameters
  ----------
  X: str (variable name)
      The cause/exposure variables.
  
  Y: str (variable name)
      The outcome variable.
  
  Z: list (array-like)
      List of adjustment variables.
  
  Returns
  -------
  Is valid frontdoor adjustment: bool
      True if Z is a valid frontdoor adjustment set.
docstr_tok: ["Test","whether","Z","is","a","valid","frontdoor","adjustment","set","for","estimating","the","causal","impact","of","X","on","Y","via","the","frontdoor","adjustment","formula",".","Parameters","--","--","--","--","--","X",":","str","(","variable","name",")","The","cause\/exposure","variables",".","Y",":","str","(","variable","name",")","The","outcome","variable",".","Z",":","list","(","array-like",")","List","of","adjustment","variables",".","Returns","--","--","--","-","Is","valid","frontdoor","adjustment",":","bool","True","if","Z","is","a","valid","frontdoor","adjustment","set","."]
code: def is_valid_frontdoor_adjustment_set(self, X, Y, Z=None):
      """
      Test whether Z is a valid frontdoor adjustment set for estimating the causal impact of X on Y via the frontdoor
      adjustment formula.
  
      Parameters
      ----------
      X: str (variable name)
          The cause/exposure variables.
  
      Y: str (variable name)
          The outcome variable.
  
      Z: list (array-like)
          List of adjustment variables.
  
      Returns
      -------
      Is valid frontdoor adjustment: bool
          True if Z is a valid frontdoor adjustment set.
      """
      Z = _variable_or_iterable_to_set(Z)
  
      # 0. Get all directed paths from X to Y.  Don't check further if there aren't any.
      directed_paths = list(nx.all_simple_paths(self.model, X, Y))
  
      if directed_paths == []:
          return False
  
      # 1. Z intercepts all directed paths from X to Y
      unblocked_directed_paths = [
          path
          for path in directed_paths
          if not any(zz in path for zz in Z)
      ]
  
      if unblocked_directed_paths:
          return False
  
      # 2. there is no backdoor path from X to Z
      unblocked_backdoor_paths_X_Z = [
          zz
          for zz in Z
          if not self.is_valid_backdoor_adjustment_set(X, zz)
      ]
  
      if unblocked_backdoor_paths_X_Z:
          return False
  
      # 3. All back-door paths from Z to Y are blocked by X
      valid_backdoor_sets = []
      for zz in Z:
          valid_backdoor_sets.append(
              self.is_valid_backdoor_adjustment_set(zz, Y, X)
          )
      if not all(valid_backdoor_sets):
          return False
  
      return True
  
imports: from collections.abc import Iterable
  from itertools import chain, product
  import networkx
  import numpy
  from tqdm.auto import tqdm
  from pgmpy import config
  from pgmpy.estimators.LinearModel import LinearEstimator
  from pgmpy.factors.discrete import DiscreteFactor
  from pgmpy.models import BayesianNetwork
  from pgmpy.utils.sets import _powerset, _variable_or_iterable_to_set
label_desc: Use image node_id 5 for calling the CausalInference obj's underlying member method code with example usage: obj.is_valid_frontdoor_adjustment_set(X, Y, Z) and returns: True, False, False, False, False