Exemplo n.º 1
0
    def __init__(self, health_model=False, mock = None):
        '''
        Constructor
        '''
        if mock:
            if mock > 1:
                self.mock_hmm = True
            else:
                self.mock_hmm = False
            self.mock = True
        else:
            self.mock = False
        
        self.health_model = health_model
        if health_model:
            print 'Running Wikipedia example: Health model.'
            from skald.hmm.model.health import HealthModel
            from skald.hmm.model.health.elements import Symptom
            self.observations = [Symptom('normal'),
                        Symptom('cold'),
                        Symptom('dizzy')]

            self.hmm = Hmm(HealthModel, self.observations)
            self.hmm.find_most_likely_state_seq()
            self.hmm.print_path()

        else:
            print 'Running Rhythm model calculations.'
            
            self.uinput_handler = UserInputHandler(self.mock)
Exemplo n.º 2
0
    def run_model(self):
        o_len = len(self.observations)
        self.hmm = [None] * o_len
        self.beat_paths = BeatPathSet(o_len)

        for i in range(o_len):
            self.hmm[i] = Hmm(RhythmModel, self.observations[i])
            self.beat_paths[i] = self.hmm[i].find_most_likely_state_seq()
            self.hmm[i].print_path()
            # TODO: circumventing BeatPaths lacking implementation
            # It should wrap it's list properly instead of
            # explicitly referencing the internal 'path' variable 
            self.hmm[i].model.print_beats(self.beat_paths[i].path, self.observations[i])
            # TODO: fix this, very ugly!
            BeatPair._reset_object_counter()