def compute_scores(self, sequence):
        num_states = self.get_num_states()
        length = len(sequence.x)
        emission_scores = np.zeros([length, num_states])
        initial_scores = np.zeros(num_states)
        transition_scores = np.zeros([length-1, num_states, num_states])
        final_scores = np.zeros(num_states)

        # Initial position.
        for tag_id in xrange(num_states):
             initial_features = self.feature_mapper.get_initial_features(sequence, tag_id)
             score = 0.0
             for feat_id in initial_features:
                 score += self.parameters[feat_id]
             initial_scores[tag_id] = score

        # Intermediate position.
        for pos in xrange(length):
            for tag_id in xrange(num_states):
                 emission_features = self.feature_mapper.get_emission_features(sequence, pos, tag_id)
                 score = 0.0
                 for feat_id in emission_features:
                     score += self.parameters[feat_id]
                 emission_scores[pos, tag_id] = score
            if pos > 0: 
                for tag_id in xrange(num_states):
                    for prev_tag_id in xrange(num_states):
                        transition_features = self.feature_mapper.get_transition_features(sequence, pos, tag_id, prev_tag_id)
                        score = 0.0
                        for feat_id in transition_features:
                            score += self.parameters[feat_id]
                        transition_scores[1-pos, tag_id, prev_tag_id] = score

        # Final position.
        for prev_tag_id in xrange(num_states):
             final_features = self.feature_mapper.get_final_features(sequence, prev_tag_id)
             score = 0.0
             for feat_id in final_features:
                 score += self.parameters[feat_id]
             final_scores[prev_tag_id] = score

        return initial_scores, transition_scores, final_scores, emission_scores
dataset/ETHPy150Open LxMLS/lxmls-toolkit/lxmls/sequences/discriminative_sequence_classifier.py/DiscriminativeSequenceClassifier.compute_scores/swapped operands of `-`