class_docstr: Base class of *DiscreteFactor Sets*.
  
  A factor set provides a compact representation of  higher dimensional factor
  :math:`\phi_1\cdot\phi_2\cdots\phi_n`
  
  For example the factor set corresponding to factor :math:`\phi_1\cdot\phi_2` would be the union of the factors
  :math:`\phi_1` and :math:`\phi_2` i.e. factor set :math:`\vec\phi = \phi_1 \cup \phi_2`.
class_docstr_tok: ["Base","class","of","*","DiscreteFactor","Sets","*",".","A","factor","set","provides","a","compact","representation","of","higher","dimensional","factor",":","math",":","`","\\phi_1\\cdot\\phi_2\\cdots\\phi_n","`","For","example","the","factor","set","corresponding","to","factor",":","math",":","`","\\phi_1\\cdot\\phi_2","`","would","be","the","union","of","the","factors",":","math",":","`","\\phi_1","`","and",":","math",":","`","\\phi_2","`","i.e",".","factor","set",":","math",":","`","\\vec\\phi","=","\\phi_1","\\cup","\\phi_2","`","."]
docstr: Returns a new factor set instance after division by the factor set
  
  Division of two factor sets :math:`\frac{\vec\phi_1}{\vec\phi_2}` basically translates to union of all the
  factors present in :math:`\vec\phi_2` and :math:`\frac{1}{\phi_i}` of all the factors present in
  :math:`\vec\phi_2`.
  
  Parameters
  ----------
  factorset: FactorSet
      The divisor
  
  inplace: A boolean (Default value True)
      If inplace = True ,then it will modify the FactorSet object, if False then will
      return a new FactorSet object.
  
  Returns
  --------
  If inplace = False, will return a new FactorSet Object which is division of
  given factors.
  
  Examples
  --------
  >>> from pgmpy.factors import FactorSet
  >>> from pgmpy.factors.discrete import DiscreteFactor
  >>> phi1 = DiscreteFactor(['x1', 'x2', 'x3'], [2, 3, 2], range(12))
  >>> phi2 = DiscreteFactor(['x3', 'x4', 'x1'], [2, 2, 2], range(8))
  >>> factor_set1 = FactorSet(phi1, phi2)
  >>> phi3 = DiscreteFactor(['x5', 'x6', 'x7'], [2, 2, 2], range(8))
  >>> phi4 = DiscreteFactor(['x5', 'x7', 'x8'], [2, 2, 2], range(8))
  >>> factor_set2 = FactorSet(phi3, phi4)
  >>> factor_set3 = factor_set2.divide(factor_set1)
  >>> print(factor_set3)
  set([<DiscreteFactor representing phi(x3:2, x4:2, x1:2) at 0x7f8e32b5ba10>,
       <DiscreteFactor representing phi(x5:2, x6:2, x7:2) at 0x7f8e32b5b650>,
       <DiscreteFactor representing phi(x1:2, x2:3, x3:2) at 0x7f8e32b5b050>,
       <DiscreteFactor representing phi(x5:2, x7:2, x8:2) at 0x7f8e32b5b8d0>])
docstr_tok: ["Returns","a","new","factor","set","instance","after","division","by","the","factor","set","Division","of","two","factor","sets",":","math",":","`","\\frac","{","\\vec\\phi_1","}","{","\\vec\\phi_2","}","`","basically","translates","to","union","of","all","the","factors","present","in",":","math",":","`","\\vec\\phi_2","`","and",":","math",":","`","\\frac","{","1","}","{","\\phi_i","}","`","of","all","the","factors","present","in",":","math",":","`","\\vec\\phi_2","`",".","Parameters","--","--","--","--","--","factorset",":","FactorSet","The","divisor","inplace",":","A","boolean","(","Default","value","True",")","If","inplace","=","True",",","then","it","will","modify","the","FactorSet","object",",","if","False","then","will","return","a","new","FactorSet","object",".","Returns","--","--","--","--","If","inplace","=","False",",","will","return","a","new","FactorSet","Object","which","is","division","of","given","factors",".","Examples","--","--","--","--",">",">",">","from","pgmpy.factors","import","FactorSet",">",">",">","from","pgmpy.factors.discrete","import","DiscreteFactor",">",">",">","phi1","=","DiscreteFactor","(","[","'x1","'",",","'x2","'",",","'x3","'","]",",","[","2",",","3",",","2","]",",","range","(","12",")",")",">",">",">","phi2","=","DiscreteFactor","(","[","'x3","'",",","'x4","'",",","'x1","'","]",",","[","2",",","2",",","2","]",",","range","(","8",")",")",">",">",">","factor_set1","=","FactorSet","(","phi1",",","phi2",")",">",">",">","phi3","=","DiscreteFactor","(","[","'x5","'",",","'x6","'",",","'x7","'","]",",","[","2",",","2",",","2","]",",","range","(","8",")",")",">",">",">","phi4","=","DiscreteFactor","(","[","'x5","'",",","'x7","'",",","'x8","'","]",",","[","2",",","2",",","2","]",",","range","(","8",")",")",">",">",">","factor_set2","=","FactorSet","(","phi3",",","phi4",")",">",">",">","factor_set3","=","factor_set2.divide","(","factor_set1",")",">",">",">","print","(","factor_set3",")","set","(","[","<","DiscreteFactor","representing","phi","(","x3:2",",","x4:2",",","x1:2",")","at","0x7f8e32b5ba10",">",",","<","DiscreteFactor","representing","phi","(","x5:2",",","x6:2",",","x7:2",")","at","0x7f8e32b5b650",">",",","<","DiscreteFactor","representing","phi","(","x1:2",",","x2:3",",","x3:2",")","at","0x7f8e32b5b050",">",",","<","DiscreteFactor","representing","phi","(","x5:2",",","x7:2",",","x8:2",")","at","0x7f8e32b5b8d0",">","]",")"]
code: def divide(self, factorset, inplace=True):
      r"""
      Returns a new factor set instance after division by the factor set
  
      Division of two factor sets :math:`\frac{\vec\phi_1}{\vec\phi_2}` basically translates to union of all the
      factors present in :math:`\vec\phi_2` and :math:`\frac{1}{\phi_i}` of all the factors present in
      :math:`\vec\phi_2`.
  
      Parameters
      ----------
      factorset: FactorSet
          The divisor
  
      inplace: A boolean (Default value True)
          If inplace = True ,then it will modify the FactorSet object, if False then will
          return a new FactorSet object.
  
      Returns
      --------
      If inplace = False, will return a new FactorSet Object which is division of
      given factors.
  
      Examples
      --------
      >>> from pgmpy.factors import FactorSet
      >>> from pgmpy.factors.discrete import DiscreteFactor
      >>> phi1 = DiscreteFactor(['x1', 'x2', 'x3'], [2, 3, 2], range(12))
      >>> phi2 = DiscreteFactor(['x3', 'x4', 'x1'], [2, 2, 2], range(8))
      >>> factor_set1 = FactorSet(phi1, phi2)
      >>> phi3 = DiscreteFactor(['x5', 'x6', 'x7'], [2, 2, 2], range(8))
      >>> phi4 = DiscreteFactor(['x5', 'x7', 'x8'], [2, 2, 2], range(8))
      >>> factor_set2 = FactorSet(phi3, phi4)
      >>> factor_set3 = factor_set2.divide(factor_set1)
      >>> print(factor_set3)
      set([<DiscreteFactor representing phi(x3:2, x4:2, x1:2) at 0x7f8e32b5ba10>,
           <DiscreteFactor representing phi(x5:2, x6:2, x7:2) at 0x7f8e32b5b650>,
           <DiscreteFactor representing phi(x1:2, x2:3, x3:2) at 0x7f8e32b5b050>,
           <DiscreteFactor representing phi(x5:2, x7:2, x8:2) at 0x7f8e32b5b8d0>])
      """
      factor_set = self if inplace else self.copy()
      factor_set1 = factorset.copy()
  
      factor_set.add_factors(
          *[phi.identity_factor() / phi for phi in factor_set1.factors]
      )
  
      if not inplace:
          return factor_set
  
file_path: pgmpy/pgmpy/factors/FactorSet.py
imports: from functools import reduce
  from pgmpy.factors.base import BaseFactor
label_desc: Use image node_id 6 for calling the FactorSet obj's underlying member method code with example usage: obj.divide(factorset, inplace) and returns: factor_set