class_docstr: This class is inherited by classes which deal with state names of variables.
  The state names are stored in instances of `StateNameMixin`. The conversion between
  state number and names are also handled by methods in this class.
class_docstr_tok: ["This","class","is","inherited","by","classes","which","deal","with","state","names","of","variables",".","The","state","names","are","stored","in","instances","of","`","StateNameMixin","`",".","The","conversion","between","state","number","and","names","are","also","handled","by","methods","in","this","class","."]
docstr: Initialize an instance of StateNameMixin.
  
  Example
  -------
  >>> import numpy as np
  >>> from pgmpy.factors.discrete import DiscreteFactor
  >>> sn = {'speed': ['low', 'medium', 'high'],
  ...       'switch': ['on', 'off'],
  ...       'time': ['day', 'night']}
  >>> phi = DiscreteFactor(variables=['speed', 'switch', 'time'],
  ...                      cardinality=[3, 2, 2],
  ...                      values=np.ones(12),
  ...                      state_names=sn)
  >>> print(phi.state_names)
docstr_tok: ["Initialize","an","instance","of","StateNameMixin",".","Example","--","--","--","-",">",">",">","import","numpy","as","np",">",">",">","from","pgmpy.factors.discrete","import","DiscreteFactor",">",">",">","sn","=","{","'speed","'",":","[","'low","'",",","'medium","'",",","'high","'","]",",","...","'switch","'",":","[","'on","'",",","'off","'","]",",","...","'time","'",":","[","'day","'",",","'night","'","]","}",">",">",">","phi","=","DiscreteFactor","(","variables=","[","'speed","'",",","'switch","'",",","'time","'","]",",","...","cardinality=","[","3",",","2",",","2","]",",","...","values=np.ones","(","12",")",",","...","state_names=sn",")",">",">",">","print","(","phi.state_names",")"]
code: def store_state_names(self, variables, cardinality, state_names):
      """
      Initialize an instance of StateNameMixin.
  
      Example
      -------
      >>> import numpy as np
      >>> from pgmpy.factors.discrete import DiscreteFactor
      >>> sn = {'speed': ['low', 'medium', 'high'],
      ...       'switch': ['on', 'off'],
      ...       'time': ['day', 'night']}
      >>> phi = DiscreteFactor(variables=['speed', 'switch', 'time'],
      ...                      cardinality=[3, 2, 2],
      ...                      values=np.ones(12),
      ...                      state_names=sn)
      >>> print(phi.state_names)
      """
      if state_names:
          for key, value in state_names.items():
              if not isinstance(value, (list, tuple)):
                  raise ValueError(
                      "The state names must be for the form: {variable: list_of_states}"
                  )
              elif not len(set(value)) == len(value):
                  raise ValueError(
                      f"Repeated statenames for variable: {key}"
                  )
  
          # Make a copy, so that the original object doesn't get modified after operations.
          self.state_names = state_names.copy()
          # Create maps for easy access to specific state names of state numbers.
          if state_names:
              self.name_to_no = {}
              self.no_to_name = {}
              for key, values in self.state_names.items():
                  self.name_to_no[key] = {
                      name: no
                      for no, name in enumerate(self.state_names[key])
                  }
                  self.no_to_name[key] = {
                      no: name
                      for no, name in enumerate(self.state_names[key])
                  }
      else:
          self.state_names = {
              var: list(range(int(cardinality[index])))
              for index, var in enumerate(variables)
          }
          self.name_to_no = {
              var: {i: i for i in range(int(cardinality[index]))}
              for index, var in enumerate(variables)
          }
          self.no_to_name = self.name_to_no.copy()
  
label_desc: Use image node_id 1 for calling the StateNameMixin obj's underlying member method code with example usage: obj.store_state_names(variables, cardinality, state_names) without return types