class_docstr: Class to represent a Markov Chain with multiple kernels for factored state space,
  along with methods to simulate a run.
  
  Examples
  --------
  
  Create an empty Markov Chain:
  
  >>> from pgmpy.models import MarkovChain as MC
  >>> model = MC()
  
  And then add variables to it
  
  >>> model.add_variables_from(['intel', 'diff'], [2, 3])
  
  Or directly create a Markov Chain from a list of variables and their cardinalities
  
  >>> model = MC(['intel', 'diff'], [2, 3])
  
  Add transition models
  
  >>> intel_tm = {0: {0: 0.25, 1: 0.75}, 1: {0: 0.5, 1: 0.5}}
  >>> model.add_transition_model('intel', intel_tm)
  >>> diff_tm = {0: {0: 0.1, 1: 0.5, 2: 0.4}, 1: {0: 0.2, 1: 0.2, 2: 0.6 }, 2: {0: 0.7, 1: 0.15, 2: 0.15}}
  >>> model.add_transition_model('diff', diff_tm)
  
  Set a start state
  
  >>> from pgmpy.factors.discrete import State
  >>> model.set_start_state([State('intel', 0), State('diff', 2)])
  
  Sample from it
  
  >>> model.sample(size=5)
     intel  diff
  0      0     2
  1      1     0
  2      0     1
  3      1     0
  4      0     2
class_docstr_tok: ["Class","to","represent","a","Markov","Chain","with","multiple","kernels","for","factored","state","space",",","along","with","methods","to","simulate","a","run",".","Examples","--","--","--","--","Create","an","empty","Markov","Chain",":",">",">",">","from","pgmpy.models","import","MarkovChain","as","MC",">",">",">","model","=","MC","(",")","And","then","add","variables","to","it",">",">",">","model.add_variables_from","(","[","'intel","'",",","'diff","'","]",",","[","2",",","3","]",")","Or","directly","create","a","Markov","Chain","from","a","list","of","variables","and","their","cardinalities",">",">",">","model","=","MC","(","[","'intel","'",",","'diff","'","]",",","[","2",",","3","]",")","Add","transition","models",">",">",">","intel_tm","=","{","0",":","{","0",":","0.25",",","1",":","0.75","}",",","1",":","{","0",":","0.5",",","1",":","0.5","}","}",">",">",">","model.add_transition_model","(","'intel","'",",","intel_tm",")",">",">",">","diff_tm","=","{","0",":","{","0",":","0.1",",","1",":","0.5",",","2",":","0.4","}",",","1",":","{","0",":","0.2",",","1",":","0.2",",","2",":","0.6","}",",","2",":","{","0",":","0.7",",","1",":","0.15",",","2",":","0.15","}","}",">",">",">","model.add_transition_model","(","'diff","'",",","diff_tm",")","Set","a","start","state",">",">",">","from","pgmpy.factors.discrete","import","State",">",">",">","model.set_start_state","(","[","State","(","'intel","'",",","0",")",",","State","(","'diff","'",",","2",")","]",")","Sample","from","it",">",">",">","model.sample","(","size=5",")","intel","diff","0","0","2","1","1","0","2","0","1","3","1","0","4","0","2"]
docstr: Parameters
  ----------
  variables: array-like iterable object
      A list of variables of the model.
  
  card: array-like iterable object
      A list of cardinalities of the variables.
  
  start_state: array-like iterable object
      List of tuples representing the starting states of the variables.
docstr_tok: ["Parameters","--","--","--","--","--","variables",":","array-like","iterable","object","A","list","of","variables","of","the","model",".","card",":","array-like","iterable","object","A","list","of","cardinalities","of","the","variables",".","start_state",":","array-like","iterable","object","List","of","tuples","representing","the","starting","states","of","the","variables","."]
code: def __init__(self, variables=None, card=None, start_state=None):
      """
      Parameters
      ----------
      variables: array-like iterable object
          A list of variables of the model.
  
      card: array-like iterable object
          A list of cardinalities of the variables.
  
      start_state: array-like iterable object
          List of tuples representing the starting states of the variables.
      """
      if variables is None:
          variables = []
      if card is None:
          card = []
      if not hasattr(variables, "__iter__") or isinstance(
          variables, str
      ):
          raise ValueError("variables must be a non-string iterable.")
      if not hasattr(card, "__iter__") or isinstance(card, str):
          raise ValueError("card must be a non-string iterable.")
      self.variables = variables
      self.cardinalities = {v: c for v, c in zip(variables, card)}
      self.transition_models = {var: {} for var in variables}
      if start_state is None or self._check_state(start_state):
          self.state = start_state
  
imports: from collections import defaultdict
  import numpy
  from pandas import DataFrame
  from scipy.linalg import eig
  from pgmpy.factors.discrete import State
  from pgmpy.global_vars import logger
  from pgmpy.utils import sample_discrete
label_desc: Use image node_id 1 to create a new MarkovChain object from inherited base classes: object with example: obj = MarkovChain(variables, card, start_state)