class_docstr: Initializer for XBNWriter class
  
  Parameters
  ----------
  model: BayesianNetwork Instance
      Model to write
  encoding: str(optional)
      Encoding for test data
  prettyprint: Bool(optional)
      Indentation in output XML if true
  
  Reference
  ---------
  http://xml.coverpages.org/xbn-MSdefault19990414.html
  
  Examples
  --------
  >>> writer = XBNWriter(model)
class_docstr_tok: ["Initializer","for","XBNWriter","class","Parameters","--","--","--","--","--","model",":","BayesianNetwork","Instance","Model","to","write","encoding",":","str","(","optional",")","Encoding","for","test","data","prettyprint",":","Bool","(","optional",")","Indentation","in","output","XML","if","true","Reference","--","--","--","--","-","http",":","\/\/xml.coverpages.org\/xbn-MSdefault19990414.html","Examples","--","--","--","--",">",">",">","writer","=","XBNWriter","(","model",")"]
code: def __init__(self, model, encoding="utf-8", prettyprint=True):
      if not isinstance(model, BayesianNetwork):
          raise TypeError(
              "Model must be an instance of Bayesian Model."
          )
      self.model = model
  
      self.encoding = encoding
      self.prettyprint = prettyprint
  
      self.network = etree.Element("ANALYSISNOTEBOOK")
      self.bnmodel = etree.SubElement(self.network, "BNMODEL")
      if self.model.name:
          etree.SubElement(self.bnmodel, "NAME").text = self.model.name
  
      self.variables = self.set_variables(self.model.nodes)
      self.structure = self.set_edges(sorted(self.model.edges()))
      self.distribution = self.set_distributions()
  
imports: import itertools
  import xml.etree.ElementTree
  import networkx
  import numpy
  from pgmpy.factors.discrete import TabularCPD
  from pgmpy.models import BayesianNetwork
label_desc: Use image node_id 1 to create a new XBNWriter object from inherited base classes: object with example: obj = XBNWriter(model, encoding, prettyprint)