Code Duplication    Length = 7-7 lines in 2 locations

pyActLearn/learning/hmm.py 2 locations

@@ 149-155 (lines=7) @@
146
                for i in range(window, x.shape[0]):
147
                    result[i] = model.predict(x[i-window+1:i+1])[-1]
148
        else:
149
            if window == -1:
150
                result = self.decode(x, init_prob)
151
            else:
152
                result = np.zeros(x.shape[0], dtype=np.int)
153
                result[0:window] = self.decode(x[0:window], init_prob)
154
                for i in range(window, x.shape[0]):
155
                    result[i] = self.decode(x[i-window+1:i+1], init_prob)[-1]
156
        return result
157
158
    def predict_prob(self, x, init_prob=None, window=-1):
@@ 141-147 (lines=7) @@
138
            model.startprob_ = init_prob
139
            model.emissionprob_ = self.B
140
            model.transmat_ = self.A
141
            if window == -1:
142
                result = model.predict(x)
143
            else:
144
                result = np.zeros(x.shape[0], dtype=np.int)
145
                result[0:window] = model.predict(x[0:window])
146
                for i in range(window, x.shape[0]):
147
                    result[i] = model.predict(x[i-window+1:i+1])[-1]
148
        else:
149
            if window == -1:
150
                result = self.decode(x, init_prob)