Skip to content

Commit 1ec9fb4

Browse files
Simplify candidate generation in apriori function by removing unnecessary list conversion
1 parent db0b898 commit 1ec9fb4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

machine_learning/apriori_algorithm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def apriori(data: list[list[str]], min_support: int) -> list[tuple[list[str], in
8181
k = 2
8282
while current_frequents:
8383
candidates = [
84-
sorted(list(set(i) | set(j)))
84+
sorted(set(i) | set(j))
8585
for i in current_frequents
8686
for j in current_frequents
8787
if len(set(i).union(j)) == k

0 commit comments

Comments
 (0)