Last active
April 7, 2018 19:24
-
-
Save CharlesRajendran/4e29cc9a0abd8c2f6e173bf8b9ca810d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
dataset = pd.read_csv("data.csv", header=None) | |
# apriori expects the input as list of list | |
# [ [item1, item2], [item2, item3, item4], ..... ] ] | |
transactions = [] | |
for i in range(0, len(dataset)): | |
transactions.append([str(dataset.values[i, j]) for j in range(0, 20)]) | |
from apyori import apriori | |
associations = apriori(transactions, min_support = 0.004, min_confidence = 0.4, min_lift = 3, min_length = 2) | |
print(list(associations)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment