Package jazzparser :: Package taggers :: Package segmidi :: Package chordclass :: Module train
[hide private]
[frames] | no frames]

Module train

source code

Unsupervised EM training for chordclass HMM tagging model.


Author: Mark Granroth-Wilding <mark.granroth-wilding@ed.ac.uk>

Classes [hide private]
  ChordClassBaumWelchTrainer
Class with methods to retrain a chordclass model using the Baum-Welch EM algorithm.
Functions [hide private]
 
_sequence_updates(sequence, last_model, label_dom, schema_ids, emission_cond_ids, update_initial=True, catch_interrupt=False)
Evaluates the forward/backward probability matrices for a single sequence under the model that came from the previous iteration and returns matrices that contain the updates to be made to the distributions during this iteration.
source code
Variables [hide private]
  ADD_SMALL = 1e-10
  __package__ = 'jazzparser.taggers.segmidi.chordclass'
Function Details [hide private]

_sequence_updates(sequence, last_model, label_dom, schema_ids, emission_cond_ids, update_initial=True, catch_interrupt=False)

source code 

Evaluates the forward/backward probability matrices for a single sequence under the model that came from the previous iteration and returns matrices that contain the updates to be made to the distributions during this iteration.

This is wrapped up in a function so it can be run in parallel for each sequence. Once all sequences have been evaluated, the results are combined and model updated.

Parameters:
  • update_initial (bool) - usually you want to update all distributions, including the initial state distribution. If update_initial=False, the initial state distribution updates won't be made for this sequence. We want this when the sequence is actually a non-initial fragment of a longer sequence
  • catch_interrupt (bool) - catch KeyboardInterrupt exceptions and return None. This is useful behaviour when calling this in a process pool, since it allows the parent process to handle the interrupt, but should be set to False (default) if calling directly.