source: orange/Orange/doc/reference/MeasureAttribute1b.py @ 9671:a7b056375472

Revision 9671:a7b056375472, 977 bytes checked in by anze <anze.staric@…>, 2 years ago (diff)

Moved orange to Orange (part 2)

Line 
1# Description: Shows how to use probability estimators with measure of attribute quality
2# Category:    attribute quality
3# Classes:     MeasureAttribute, MeasureAttribute_info, ProbabilityEstimatorConstructor_m, ConditionalProbabilityEstimatorConstructor_ByRows
4# Uses:        lenses
5# Referenced:  MeasureAttribute.htm
6
7import orange
8data = orange.ExampleTable("lenses")
9
10ms = (0, 2, 5, 10, 20)
11measures = []
12for m in ms:
13    meas = orange.MeasureAttribute_info()
14    meas.estimatorConstructor = orange.ProbabilityEstimatorConstructor_m(m = m)
15    meas.conditionalEstimatorConstructor = orange.ConditionalProbabilityEstimatorConstructor_ByRows()
16    meas.conditionalEstimatorConstructor.estimatorConstructor = meas.estimatorConstructor
17    measures.append(meas)
18
19print "%15s\t%5i\t%5i\t%5i\t%5i\t%5i\t" % (("attr",) + ms)
20for attr in data.domain.attributes:
21    print "%15s\t%5.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f" % ((attr.name,) + tuple([meas(attr, data) for meas in measures]))
Note: See TracBrowser for help on using the repository browser.