class_docstr: Transition model for beat tracking with a HMM.
  
  Within the beat the tempo stays the same; at beat boundaries transitions
  from one tempo (i.e. interval) to another are allowed, following an
  exponential distribution.
  
  Parameters
  ----------
  state_space : :class:`BeatStateSpace` instance
      BeatStateSpace instance.
  transition_lambda : float
      Lambda for the exponential tempo change distribution (higher values
      prefer a constant tempo from one beat to the next one).
  
  References
  ----------
  .. [1] Florian Krebs, Sebastian Böck and Gerhard Widmer,
         "An Efficient State Space Model for Joint Tempo and Meter Tracking",
         Proceedings of the 16th International Society for Music Information
         Retrieval Conference (ISMIR), 2015.
class_docstr_tok: ["Transition","model","for","beat","tracking","with","a","HMM",".","Within","the","beat","the","tempo","stays","the","same",";","at","beat","boundaries","transitions","from","one","tempo","(","i.e",".","interval",")","to","another","are","allowed",",","following","an","exponential","distribution",".","Parameters","--","--","--","--","--","state_space",":",":","class",":","`","BeatStateSpace","`","instance","BeatStateSpace","instance",".","transition_lambda",":","float","Lambda","for","the","exponential","tempo","change","distribution","(","higher","values","prefer","a","constant","tempo","from","one","beat","to","the","next","one",")",".","References","--","--","--","--","--","..","[","1","]","Florian","Krebs",",","Sebastian","B\u00f6ck","and","Gerhard","Widmer",",","``","An","Efficient","State","Space","Model","for","Joint","Tempo","and","Meter","Tracking","''",",","Proceedings","of","the","16th","International","Society","for","Music","Information","Retrieval","Conference","(","ISMIR",")",",","2015","."]
code: def __init__(self, state_space, transition_lambda):
      # save attributes
      self.state_space = state_space
      self.transition_lambda = float(transition_lambda)
      # same tempo transitions probabilities within the state space is 1
      # Note: use all states, but remove all first states because there are
      #       no same tempo transitions into them
      states = np.arange(state_space.num_states, dtype=np.uint32)
      states = np.setdiff1d(states, state_space.first_states)
      prev_states = states - 1
      probabilities = np.ones_like(states, dtype=float)
      # tempo transitions occur at the boundary between beats
      # Note: connect the beat state space with itself, the transitions from
      #       the last states to the first states follow an exponential tempo
      #       transition (with the tempi given as intervals)
      to_states = state_space.first_states
      from_states = state_space.last_states
      from_int = state_space.state_intervals[from_states]
      to_int = state_space.state_intervals[to_states]
      prob = exponential_transition(
          from_int, to_int, self.transition_lambda
      )
      # use only the states with transitions to/from != 0
      from_prob, to_prob = np.nonzero(prob)
      states = np.hstack((states, to_states[to_prob]))
      prev_states = np.hstack((prev_states, from_states[from_prob]))
      probabilities = np.hstack((probabilities, prob[prob != 0]))
      # make the transitions sparse
      transitions = self.make_sparse(states, prev_states, probabilities)
      # instantiate a TransitionModel
      super(BeatTransitionModel, self).__init__(*transitions)
  
imports: from __future__ import absolute_import, division, print_function
  import numpy
  from madmom.ml.hmm import ObservationModel, TransitionModel
label_desc: Use image node_id 1 to create a new BeatTransitionModel object from inherited base classes: TransitionModel with example: obj = BeatTransitionModel(state_space, transition_lambda)