class_docstr: Class to calculate probability (pmf) values specific to Bayesian Models
  
  Parameters
  ----------
  model: Bayesian Model
      model on which inference queries will be computed
class_docstr_tok: ["Class","to","calculate","probability","(","pmf",")","values","specific","to","Bayesian","Models","Parameters","--","--","--","--","--","model",":","Bayesian","Model","model","on","which","inference","queries","will","be","computed"]
docstr: Get probability arrays for a node as function of conditional dependencies
  
  Internal function used for Bayesian networks, eg. in BayesianModelSampling
  and BayesianModelProbability.
  
  Parameters
  ----------
  variable: Bayesian Model Node
      node of the Bayesian network
  
  Returns
  -------
  dict: dictionary with probability array for node
      as function of conditional dependency values
docstr_tok: ["Get","probability","arrays","for","a","node","as","function","of","conditional","dependencies","Internal","function","used","for","Bayesian","networks",",","eg",".","in","BayesianModelSampling","and","BayesianModelProbability",".","Parameters","--","--","--","--","--","variable",":","Bayesian","Model","Node","node","of","the","Bayesian","network","Returns","--","--","--","-","dict",":","dictionary","with","probability","array","for","node","as","function","of","conditional","dependency","values"]
code: def pre_compute_reduce(self, variable):
      """
      Get probability arrays for a node as function of conditional dependencies
  
      Internal function used for Bayesian networks, eg. in BayesianModelSampling
      and BayesianModelProbability.
  
      Parameters
      ----------
      variable: Bayesian Model Node
          node of the Bayesian network
  
      Returns
      -------
      dict: dictionary with probability array for node
          as function of conditional dependency values
      """
      variable_cpd = self.model.get_cpds(variable)
      variable_evid = variable_cpd.variables[:0:-1]
      cached_values = {}
  
      for state_combination in itertools.product(
          *[range(self.cardinality[var]) for var in variable_evid]
      ):
          states = list(zip(variable_evid, state_combination))
          cached_values[state_combination] = variable_cpd.reduce(
              states, inplace=False, show_warnings=False
          ).values
  
      return cached_values
  
imports: import itertools
  import math
  import os
  import networkx
  import numpy
  import pandas
  from joblib import Parallel, delayed
  from pgmpy.inference import Inference
  from pgmpy.utils import _check_1d_array_object, _check_length_equal, compat_fns
label_desc: Use image node_id 2 for calling the BayesianModelInference obj's underlying member method code with example usage: obj.pre_compute_reduce(variable) and returns: cached_values