fp-growth icon indicating copy to clipboard operation
fp-growth copied to clipboard

Different rules on regenerating

Open ashishkg0022 opened this issue 6 years ago • 4 comments

I get different rules, each time I run the code.


transaction = [['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14',\
 '15', '16', '7', '17', '18', '19', '20', '21', '7', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '29', '30'], ['32', '33'],\ 
['34', '34', '34', '34', '34', '34', '34', '34', '35', '35', '36', '36', '34', '34', '37', '37', '37', '37',\
 '37', '37', '34', '34', '29', '30', '36', '36', '36', '36', '36', '36']]

import pyfpgrowth as fg
patterns = fg.find_frequent_patterns(transaction, 3)
rules = fg.generate_association_rules(patterns, 0.1)

Can anyone see it ?

ashishkg0022 avatar Oct 06 '18 17:10 ashishkg0022

Ran this code three times and rules always are consistent as below (('37',), 1.25)

(('30',), 1.5) (('34',), 1.0) (('30',), 1.0) (('30',), 1.0) ((), 0.2916666666666667) (('37',), 0.15625) (('37',), 6.0) (('36',), 1.0) ((), 0.3125) (('36',), 0.20833333333333334) (('29',), 1.0) (('30',), 1.0) (('29',), 1.0) ((), 1.0) ((), 0.3125) (('30',), 1.5) (('30',), 1.0) (('30',), 1.0) (('37',), 6.0) (('36',), 1.0) (('36',), 1.0) (('37',), 6.0) (('34',), 2.5) (('36',), 1.0) (('34',), 12.0) (('37',), 6.0) ((), 0.20833333333333334) (('34',), 1.0) (('34',), 12.0) (('29', '30'), 1.0) (('30',), 1.0) (('30',), 1.0) (('30',), 0.3125) (('30',), 1.0) (('34',), 1.0) (('34',), 1.0) ((), 0.3125) (('36',), 1.0) (('36',), 8.0) ((), 0.20833333333333334) (('34',), 12.0) (('30',), 2.0) (('30', '34'), 1.0) (('30',), 2.0) (('29',), 1.0) (('29',), 1.5) (('34',), 1.0) (('30',), 1.0) ((), 1.0) (('37',), 0.15625) (('29', '34'), 1.0) ((), 0.3125) (('30',), 1.0) (('29',), 1.0) (('36', '37'), 1.25) (('30', '37'), 6.0) ((), 0.3125) (('29',), 1.0) (('30', '36'), 1.0)

Rbain2 avatar Dec 09 '18 21:12 Rbain2

I am running it on python3. Are you using python2 or python3 ?

ashishkg0022 avatar Dec 15 '18 04:12 ashishkg0022

I am using python 2.7

Rbain2 avatar Dec 15 '18 11:12 Rbain2

The issue may be with python 3.

ashishkg0022 avatar Dec 20 '18 13:12 ashishkg0022