class_docstr: Observation model for downbeat tracking with a HMM.
  
  Parameters
  ----------
  state_space : :class:`BarStateSpace` instance
      BarStateSpace instance.
  observation_lambda : int
      Split each (down-)beat period into `observation_lambda` parts, the
      first representing (down-)beat states and the remaining non-beat
      states.
  
  References
  ----------
  .. [1] Sebastian Böck, Florian Krebs and Gerhard Widmer,
         "Joint Beat and Downbeat Tracking with Recurrent Neural Networks"
         Proceedings of the 17th International Society for Music Information
         Retrieval Conference (ISMIR), 2016.
class_docstr_tok: ["Observation","model","for","downbeat","tracking","with","a","HMM",".","Parameters","--","--","--","--","--","state_space",":",":","class",":","`","BarStateSpace","`","instance","BarStateSpace","instance",".","observation_lambda",":","int","Split","each","(","down-",")","beat","period","into","`","observation_lambda","`","parts",",","the","first","representing","(","down-",")","beat","states","and","the","remaining","non-beat","states",".","References","--","--","--","--","--","..","[","1","]","Sebastian","B\u00f6ck",",","Florian","Krebs","and","Gerhard","Widmer",",","``","Joint","Beat","and","Downbeat","Tracking","with","Recurrent","Neural","Networks","''","Proceedings","of","the","17th","International","Society","for","Music","Information","Retrieval","Conference","(","ISMIR",")",",","2016","."]
docstr: Compute the log densities of the observations.
  
  Parameters
  ----------
  observations : numpy array, shape (N, 2)
      Observations (i.e. 2D activations of a RNN, the columns represent
      'beat' and 'downbeat' probabilities)
  
  Returns
  -------
  numpy array, shape (N, 3)
      Log densities of the observations, the columns represent the
      observation log probability densities for no-beats, beats and
      downbeats.
docstr_tok: ["Compute","the","log","densities","of","the","observations",".","Parameters","--","--","--","--","--","observations",":","numpy","array",",","shape","(","N",",","2",")","Observations","(","i.e",".","2D","activations","of","a","RNN",",","the","columns","represent","'beat","'","and","'downbeat","'","probabilities",")","Returns","--","--","--","-","numpy","array",",","shape","(","N",",","3",")","Log","densities","of","the","observations",",","the","columns","represent","the","observation","log","probability","densities","for","no-beats",",","beats","and","downbeats","."]
code: def log_densities(self, observations):
      """
      Compute the log densities of the observations.
  
      Parameters
      ----------
      observations : numpy array, shape (N, 2)
          Observations (i.e. 2D activations of a RNN, the columns represent
          'beat' and 'downbeat' probabilities)
  
      Returns
      -------
      numpy array, shape (N, 3)
          Log densities of the observations, the columns represent the
          observation log probability densities for no-beats, beats and
          downbeats.
  
      """
      # init densities
      log_densities = np.empty((len(observations), 3), dtype=float)
      # Note: it's faster to call np.log multiple times instead of once on
      #       the whole 2d array
      log_densities[:, 0] = np.log(
          (1.0 - np.sum(observations, axis=1))
          / (self.observation_lambda - 1)
      )
      log_densities[:, 1] = np.log(observations[:, 0])
      log_densities[:, 2] = np.log(observations[:, 1])
      # return the densities
      return log_densities
  
imports: from __future__ import absolute_import, division, print_function
  import numpy
  from madmom.ml.hmm import ObservationModel, TransitionModel
label_desc: Use image node_id 2 for calling the RNNDownBeatTrackingObservationModel obj's underlying member method code with example usage: obj.log_densities(observations) and returns: log_densities