source: orange/orange/doc/reference/MeasureAttribute1b.py @ 526:fe2d65da2b2a

Revision 526:fe2d65da2b2a, 977 bytes checked in by janezd <janez.demsar@…>, 10 years ago (diff)
  • moved documentation from a separate module to this one
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.