コード例 #1
0
def main():
    data = orange.ExampleTable(join(util.module_path(), "f_assoc"))
    data = orange.Preprocessor_discretize(data, method=orange.EquiNDiscretization(numberOfIntervals=4))

    rules = orange.AssociationRulesInducer(data, support=0.2)

    orngAssoc.sort(rules, ["confidence", "support"])
    orngAssoc.printRules(rules, ["support", "confidence"])
コード例 #2
0
    def startMining(self, var, sup):
        data = orange.ExampleTable("data/finalData.csv")
        #was47
        data = data.select(range(44))

        minSupport = float(sup)

        rules = orange.AssociationRulesInducer(data,
                                               support=minSupport,
                                               max_item_sets=30000000)

        print "%i rules with support higher than or equal to %5.3f found." % (
            len(rules), minSupport)

        orngAssoc.printRules(rules[:10], ["support", "confidence"])
コード例 #3
0
ファイル: assoc.py プロジェクト: FAB4D/humanitas
	def startMining(self, var, sup):
		data = orange.ExampleTable("data/finalData.csv") 
		#was47
		data = data.select(range(44))

		minSupport = float(sup)	

	
		rules = orange.AssociationRulesInducer(data, support = minSupport, max_item_sets = 30000000) 
	
	
	
		print "%i rules with support higher than or equal to %5.3f found." % (len(rules), minSupport) 
		
		orngAssoc.printRules(rules[:10], ["support", "confidence"]) 

		
		
コード例 #4
0
ファイル: assocToFile.py プロジェクト: albu89/humanitas
	def startMining(self, var):
		data = orange.ExampleTable("data/finalData.csv") 
		#was47
		data = data.select(range(44))

		minSupport = 0.4	

	
		rules = orange.AssociationRulesInducer(data, support = minSupport, max_item_sets = 30000000) 
	
		orig_stdout = sys.stdout
	
		f = open('results/{}_assocrules.txt'.format(var), 'w')
		sys.stdout = f
		print "%i rules with support higher than or equal to %5.3f found." % (len(rules), minSupport) 
		orngAssoc.printRules(rules[:10], ["support", "confidence"]) > f

		sys.stdout = orig_stdout

		f.close()
コード例 #5
0
ファイル: runorange.py プロジェクト: dreampocketit/bocard
import Orange, orngAssoc
data = Orange.data.Table("TermPost.basket")

rules = Orange.associate.AssociationRulesSparseInducer(data, support=0.05)
orngAssoc.sort(rules, ["confidence","support"])
orngAssoc.printRules(rules[100:200], ["support", "confidence"])
#print "%4s %4s  %s" % ("Supp", "Conf", "Rule")
#for r in rules[:500]:
#    print "%4.1f %4.1f  %s" % (r.support, r.confidence, r)
コード例 #6
0
ファイル: assoc2.py プロジェクト: electricFeel/BeatKeeperHRM
# Description: Association rule sorting and filtering
# Category:    description
# Uses:        imports-85
# Classes:     orngAssoc.build, Preprocessor_discretize, EquiNDiscretization
# Referenced:  assoc.htm

import orange, orngAssoc

data = orange.ExampleTable("imports-85")
data = orange.Preprocessor_discretize(data, \
  method=orange.EquiNDiscretization(numberOfIntervals=3))
data = data.select(range(10))

rules = orange.AssociationRulesInducer(data, support=0.4)

n = 5
print "%i most confident rules:" % (n)
orngAssoc.sort(rules, ["confidence", "support"])
orngAssoc.printRules(rules[0:n], ['confidence', 'support', 'lift'])

conf = 0.8
lift = 1.1
print "\nRules with confidence>%5.3f and lift>%5.3f" % (conf, lift)
rulesC = rules.filter(lambda x: x.confidence > conf and x.lift > lift)
orngAssoc.sort(rulesC, ['confidence'])
orngAssoc.printRules(rulesC, ['confidence', 'support', 'lift'])
コード例 #7
0
ファイル: assoc2.py プロジェクト: electricFeel/BeatKeeperHRM
# Description: Association rule sorting and filtering
# Category:    description
# Uses:        imports-85
# Classes:     orngAssoc.build, Preprocessor_discretize, EquiNDiscretization
# Referenced:  assoc.htm

import orange, orngAssoc

data = orange.ExampleTable("imports-85")
data = orange.Preprocessor_discretize(data, \
  method=orange.EquiNDiscretization(numberOfIntervals=3))
data = data.select(range(10))

rules = orange.AssociationRulesInducer(data, support = 0.4)

n = 5
print "%i most confident rules:" % (n)
orngAssoc.sort(rules, ["confidence"])
orngAssoc.printRules(rules[0:n], ['confidence','support','lift'])

conf = 0.8; lift = 1.1
print "\nRules with confidence>%5.3f and lift>%5.3f" % (conf, lift)
rulesC=rules.filter(lambda x: x.confidence>conf and x.lift>lift)
orngAssoc.sort(rulesC, ['confidence'])
orngAssoc.printRules(rulesC, ['confidence','support','lift'])
コード例 #8
0
import Orange, orngAssoc
data = Orange.data.Table("TermPost.basket")

rules = Orange.associate.AssociationRulesSparseInducer(data, support=0.05)
orngAssoc.sort(rules, ["confidence", "support"])
orngAssoc.printRules(rules[100:200], ["support", "confidence"])
#print "%4s %4s  %s" % ("Supp", "Conf", "Rule")
#for r in rules[:500]:
#    print "%4.1f %4.1f  %s" % (r.support, r.confidence, r)
コード例 #9
0
ファイル: assoc1.py プロジェクト: stefie10/slu_hri
# Description: Creates a list of association rules, selects five rules and prints them out
# Category:    description
# Uses:        imports-85
# Classes:     orngAssoc.build, Preprocessor_discretize, EquiNDiscretization
# Referenced:  assoc.htm

import orange, orngAssoc

data = orange.ExampleTable("imports-85")
data = orange.Preprocessor_discretize(data, \
  method=orange.EquiNDiscretization(numberOfIntervals=3))
data = data.select(range(10))

rules = orange.AssociationRulesInducer(data, support=0.4)

print "%i rules with support higher than or equal to %5.3f found.\n" % (len(rules), 0.4)

orngAssoc.sort(rules, ["support", "confidence"])

orngAssoc.printRules(rules[:5], ["support", "confidence"])
print

del rules[:3]
orngAssoc.printRules(rules[:5], ["support", "confidence"])
print