コード例 #1
0
    def sequence_updates_callback(self, result):
        if result is None:
            # Process cancelled: do no updates
            return

        # The members of the result tuple (apart from the logprob at the end)
        #  should match up with the array they're to be added to in global_arrays
        for local_array, global_array in zip(result[:10], self.global_arrays):
            # Add the arrays together and store the result in the global array
            array_add(global_array, local_array, global_array)
コード例 #2
0
    def sequence_updates_callback(self, result):
        if result is None:
            # Process cancelled: do no updates
            return

        # The members of the result tuple (apart from the logprob at the end)
        #  should match up with the array they're to be added to in global_arrays
        for local_array, global_array in zip(result[:10], self.global_arrays):
            # Add the arrays together and store the result in the global array
            array_add(global_array, local_array, global_array)
コード例 #3
0
ファイル: baumwelch.py プロジェクト: johndpope/jazzparser
    def sequence_updates_callback(self, result):
        """
        Callback for the sequence_updates processes that takes 
        the updates from a single sequence and adds them onto 
        the global update accumulators.
        
        The accumulators are stored as self.global_arrays.
        
        """
        if result is None:
            # Process cancelled: do no updates
            logger.warning("Child process was cancelled")
            return

        # sequence_updates() returns all of this as a tuple
        (trans_local, ems_local, \
         trans_denom_local, ems_denom_local, \
         seq_logprob) = result
        # Get the global arrays that we're updating
        (trans, ems, trans_denom, ems_denom) = self.global_arrays

        # Add these probabilities from this sequence to the
        #  global matrices
        # Emission numerator
        array_add(ems, ems_local, ems)
        # Transition numerator
        array_add(trans, trans_local, trans)
        # Denominators
        array_add(ems_denom, ems_denom_local, ems_denom)
        array_add(trans_denom, trans_denom_local, trans_denom)
コード例 #4
0
ファイル: baumwelch.py プロジェクト: johndpope/jazzparser
 def sequence_updates_callback(self, result):
     """
     Callback for the sequence_updates processes that takes 
     the updates from a single sequence and adds them onto 
     the global update accumulators.
     
     The accumulators are stored as self.global_arrays.
     
     """
     if result is None:
         # Process cancelled: do no updates
         logger.warning("Child process was cancelled")
         return
     
     # sequence_updates() returns all of this as a tuple
     (trans_local, ems_local, \
      trans_denom_local, ems_denom_local, \
      seq_logprob) = result
     # Get the global arrays that we're updating
     (trans, ems, 
      trans_denom, ems_denom) = self.global_arrays
     
     # Add these probabilities from this sequence to the 
     #  global matrices
     # Emission numerator
     array_add(ems, ems_local, ems)
     # Transition numerator
     array_add(trans, trans_local, trans)
     # Denominators
     array_add(ems_denom, ems_denom_local, ems_denom)
     array_add(trans_denom, trans_denom_local, trans_denom)
コード例 #5
0
ファイル: train.py プロジェクト: johndpope/jazzparser
 def _training_callback(result):
     """
     Callback for the _sequence_updates processes that takes 
     the updates from a single sequence and adds them onto 
     the global update accumulators.
     
     """
     # _sequence_updates() returns all of this as a tuple
     (ems_local, ems_denom_local, seq_logprob) = result
     
     # Add these probabilities from this sequence to the 
     #  global matrices
     # Emission numerator
     array_add(ems, ems_local, ems)
     # Denominators
     array_add(ems_denom, ems_denom_local, ems_denom)
コード例 #6
0
            def _training_callback(result):
                """
                Callback for the _sequence_updates processes that takes 
                the updates from a single sequence and adds them onto 
                the global update accumulators.
                
                """
                # _sequence_updates() returns all of this as a tuple
                (ems_local, ems_denom_local, seq_logprob) = result

                # Add these probabilities from this sequence to the
                #  global matrices
                # Emission numerator
                array_add(ems, ems_local, ems)
                # Denominators
                array_add(ems_denom, ems_denom_local, ems_denom)
コード例 #7
0
ファイル: train.py プロジェクト: johndpope/jazzparser
 def _training_callback(result):
     """
     Callback for the _sequence_updates processes that takes 
     the updates from a single sequence and adds them onto 
     the global update accumulators.
     
     """
     # _sequence_updates() returns all of this as a tuple
     (ktrans_local, ctrans_local, ems_local, uni_chords_local, \
      ktrans_denom_local, ctrans_denom_local, ems_denom_local, \
      uni_chords_denom_local, \
      seq_logprob) = result
     
     # Add these probabilities from this sequence to the 
     #  global matrices
     # Emission numerator
     array_add(ems, ems_local, ems)
     # Key transition numerator
     array_add(ktrans, ktrans_local, ktrans)
     # Chord transition numerator
     array_add(ctrans, ctrans_local, ctrans)
     # Unconditioned chord numerator
     array_add(uni_chords, uni_chords_local, uni_chords)
     # Denominators
     array_add(ems_denom, ems_denom_local, ems_denom)
     array_add(ktrans_denom, ktrans_denom_local, ktrans_denom)
     array_add(ctrans_denom, ctrans_denom_local, ctrans_denom)
     array_add(uni_chords_denom, uni_chords_denom_local, uni_chords_denom)
コード例 #8
0
ファイル: train.py プロジェクト: johndpope/jazzparser
 def _training_callback(result):
     """
     Callback for the _sequence_updates processes that takes 
     the updates from a single sequence and adds them onto 
     the global update accumulators.
     
     """
     if result is None:
         # Process cancelled: do no updates
         logger.warning("Child process was cancelled")
         return
     # _sequence_updates() returns all of this as a tuple
     (schema_trans_local, root_trans_local, ems_local, sinit_local, \
      schema_trans_denom_local, root_trans_denom_local, \
      ems_denom_local, sinit_denom_local, \
      seq_logprob) = result
     
     # Add these probabilities from this sequence to the 
     #  global matrices
     # We don't need to scale these using the seq prob because 
     #  they're already normalized
     
     # Emission numerator
     array_add(ems, ems_local, ems)
     # Transition numerator
     array_add(schema_trans, schema_trans_local, schema_trans)
     array_add(root_trans, root_trans_local, root_trans)
     # Initial state numerator
     array_add(sinit, sinit_local, sinit)
     # Denominators
     array_add(ems_denom, ems_denom_local, ems_denom)
     array_add(schema_trans_denom, schema_trans_denom_local, schema_trans_denom)
     array_add(root_trans_denom, root_trans_denom_local, root_trans_denom)
     array_add(sinit_denom, sinit_denom_local, sinit_denom)
コード例 #9
0
            def _training_callback(result):
                """
                Callback for the _sequence_updates processes that takes 
                the updates from a single sequence and adds them onto 
                the global update accumulators.
                
                """
                # _sequence_updates() returns all of this as a tuple
                (ktrans_local, ctrans_local, ems_local, uni_chords_local, \
                 ktrans_denom_local, ctrans_denom_local, ems_denom_local, \
                 uni_chords_denom_local, \
                 seq_logprob) = result

                # Add these probabilities from this sequence to the
                #  global matrices
                # Emission numerator
                array_add(ems, ems_local, ems)
                # Key transition numerator
                array_add(ktrans, ktrans_local, ktrans)
                # Chord transition numerator
                array_add(ctrans, ctrans_local, ctrans)
                # Unconditioned chord numerator
                array_add(uni_chords, uni_chords_local, uni_chords)
                # Denominators
                array_add(ems_denom, ems_denom_local, ems_denom)
                array_add(ktrans_denom, ktrans_denom_local, ktrans_denom)
                array_add(ctrans_denom, ctrans_denom_local, ctrans_denom)
                array_add(uni_chords_denom, uni_chords_denom_local,
                          uni_chords_denom)
コード例 #10
0
ファイル: train.py プロジェクト: johndpope/jazzparser
                def _training_callback(result):
                    """
                    Callback for the _sequence_updates processes that takes 
                    the updates from a single sequence and adds them onto 
                    the global update accumulators.
                    
                    """
                    if result is None:
                        # Process cancelled: do no updates
                        logger.warning("Child process was cancelled")
                        return
                    # _sequence_updates() returns all of this as a tuple
                    (schema_trans_local, root_trans_local, ems_local, sinit_local, \
                     schema_trans_denom_local, root_trans_denom_local, \
                     ems_denom_local, sinit_denom_local, \
                     seq_logprob) = result

                    # Add these probabilities from this sequence to the
                    #  global matrices
                    # We don't need to scale these using the seq prob because
                    #  they're already normalized

                    # Emission numerator
                    array_add(ems, ems_local, ems)
                    # Transition numerator
                    array_add(schema_trans, schema_trans_local, schema_trans)
                    array_add(root_trans, root_trans_local, root_trans)
                    # Initial state numerator
                    array_add(sinit, sinit_local, sinit)
                    # Denominators
                    array_add(ems_denom, ems_denom_local, ems_denom)
                    array_add(schema_trans_denom, schema_trans_denom_local,
                              schema_trans_denom)
                    array_add(root_trans_denom, root_trans_denom_local,
                              root_trans_denom)
                    array_add(sinit_denom, sinit_denom_local, sinit_denom)