Skip to content

Commit 0dd40ed

Browse files
committed
reformated candidates_top_uniques
1 parent 4822eee commit 0dd40ed

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tsfresh/feature_extraction/motifs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ def _candidates_top_uniques(length, candidates, count):
117117

118118
top_uniques = []
119119
for candidate in candidates:
120-
if candidate[0] not in [y for x in top_uniques for y in range(x[1], x[1] + length)] \
121-
and candidate[0] not in [y for x in top_uniques for y in
122-
range(x[0] - length, x[0] + length)]:
120+
121+
# todo: the lists should not be constructed from scratch in every iteration, maybe work with append?
122+
if candidate[0] not in [y for x in top_uniques for y in range(x[1], x[1] + length)] \
123+
and candidate[0] not in [y for x in top_uniques for y in range(x[0] - length, x[0] + length)]:
124+
123125
top_uniques.append(candidate)
124126
if len(top_uniques) >= count:
125127
break

0 commit comments

Comments
 (0)