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",")"]
docstr: Set variables for the network.
  
  Parameters
  ----------
  data: dict
      dict for variable in the form of example as shown.
  
  Examples
  --------
  >>> from pgmpy.readwrite.XMLBeliefNetwork import XBNWriter
  >>> writer = XBNWriter()
  >>> writer.set_variables({'a': {'TYPE': 'discrete', 'XPOS': '13495',
  ...                             'YPOS': '10465', 'DESCRIPTION': '(a) Metastatic Cancer',
  ...                             'STATES': ['Present', 'Absent']},
  ...                       'b': {'TYPE': 'discrete', 'XPOS': '11290',
  ...                             'YPOS': '11965', 'DESCRIPTION': '(b) Serum Calcium Increase',
  ...                             'STATES': ['Present', 'Absent']}})
docstr_tok: ["Set","variables","for","the","network",".","Parameters","--","--","--","--","--","data",":","dict","dict","for","variable","in","the","form","of","example","as","shown",".","Examples","--","--","--","--",">",">",">","from","pgmpy.readwrite.XMLBeliefNetwork","import","XBNWriter",">",">",">","writer","=","XBNWriter","(",")",">",">",">","writer.set_variables","(","{","'","a","'",":","{","'TYPE","'",":","'discrete","'",",","'XPOS","'",":","'13495","'",",","...","'YPOS","'",":","'10465","'",",","'DESCRIPTION","'",":","'","(","a",")","Metastatic","Cancer","'",",","...","'STATES","'",":","[","'Present","'",",","'Absent","'","]","}",",","...","'","b","'",":","{","'TYPE","'",":","'discrete","'",",","'XPOS","'",":","'11290","'",",","...","'YPOS","'",":","'11965","'",",","'DESCRIPTION","'",":","'","(","b",")","Serum","Calcium","Increase","'",",","...","'STATES","'",":","[","'Present","'",",","'Absent","'","]","}","}",")"]
code: def set_variables(self, data):
      """
      Set variables for the network.
  
      Parameters
      ----------
      data: dict
          dict for variable in the form of example as shown.
  
      Examples
      --------
      >>> from pgmpy.readwrite.XMLBeliefNetwork import XBNWriter
      >>> writer = XBNWriter()
      >>> writer.set_variables({'a': {'TYPE': 'discrete', 'XPOS': '13495',
      ...                             'YPOS': '10465', 'DESCRIPTION': '(a) Metastatic Cancer',
      ...                             'STATES': ['Present', 'Absent']},
      ...                       'b': {'TYPE': 'discrete', 'XPOS': '11290',
      ...                             'YPOS': '11965', 'DESCRIPTION': '(b) Serum Calcium Increase',
      ...                             'STATES': ['Present', 'Absent']}})
      """
      variables = etree.SubElement(self.bnmodel, "VARIABLES")
      for var in sorted(data):
          variable = etree.SubElement(
              variables,
              "VAR",
              attrib={
                  "NAME": var,
                  "TYPE": data[var]["TYPE"],
                  "XPOS": data[var]["XPOS"],
                  "YPOS": data[var]["YPOS"],
              },
          )
          etree.SubElement(
              variable,
              "DESCRIPTION",
              attrib={"DESCRIPTION": data[var]["DESCRIPTION"]},
          )
          for state in data[var]["STATES"]:
              etree.SubElement(variable, "STATENAME").text = state
  
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 7 for calling the XBNWriter obj's underlying member method code with example usage: obj.set_variables(data) without return types