I have two columns in a text file. I read them into Python into two separate lists. What I want to do is count the occurences of each pair and build association rules based on it.
Example:
colA = [a,b,c,d,...]
colB = [c,y,d,e,...]
I came only so far to read the data into the two lists but what is the best way to count the occurences and build the rules?
Code:
pred = []
succ = []
for line in open('arsample.txt'):
lst = line.split('\t')
pred.append(int(lst[0]))
succ.append(int(lst[1]))
Rules would look like this and are sorted descending:
P S Probability
---------------------
a > c count(a>c)/n
... ...
Have a look on sets :
They allow this :
So you will have to build the pairs in a list of strings, I guess…
Hope it can help.