docstr: Uses the evidence given to the query methods to modify the factors before running
  the variable elimination algorithm.
  
  Parameters
  ----------
  evidence: dict
      Dict of the form {variable: state}
  
  Returns
  -------
  dict: Modified working factors.
docstr_tok: ["Uses","the","evidence","given","to","the","query","methods","to","modify","the","factors","before","running","the","variable","elimination","algorithm",".","Parameters","--","--","--","--","--","evidence",":","dict","Dict","of","the","form","{","variable",":","state","}","Returns","--","--","--","-","dict",":","Modified","working","factors","."]
code: def _get_working_factors(self, evidence):
      """
      Uses the evidence given to the query methods to modify the factors before running
      the variable elimination algorithm.
  
      Parameters
      ----------
      evidence: dict
          Dict of the form {variable: state}
  
      Returns
      -------
      dict: Modified working factors.
      """
  
      working_factors = {
          node: {(factor, None) for factor in self.factors[node]}
          for node in self.factors
      }
  
      # Dealing with evidence. Reducing factors over it before VE is run.
      if evidence:
          for evidence_var in evidence:
              for factor, origin in working_factors[evidence_var]:
                  factor_reduced = factor.reduce(
                      [(evidence_var, evidence[evidence_var])],
                      inplace=False,
                  )
                  for var in factor_reduced.scope():
                      working_factors[var].remove((factor, origin))
                      working_factors[var].add(
                          (factor_reduced, evidence_var)
                      )
              del working_factors[evidence_var]
      return working_factors
  
imports: import copy
  import itertools
  import networkx
  import numpy
  from opt_einsum import contract
  from tqdm.auto import tqdm
  from pgmpy import config
  from pgmpy.factors import factor_product
  from pgmpy.factors.discrete import DiscreteFactor
  from pgmpy.inference import Inference
  from pgmpy.inference.EliminationOrder import MinFill, MinNeighbors, MinWeight, WeightedMinFill
  from pgmpy.models import BayesianNetwork, DynamicBayesianNetwork, JunctionTree, MarkovNetwork
  from pgmpy.utils import compat_fns
label_desc: Use image node_id 1 for calling the VariableElimination obj's underlying member method code with example usage: obj._get_working_factors(evidence) and returns: working_factors