source: orange/Orange/testing/regression/tests_20/reference_MeasureAttribute1b.py @ 9952:986e9cd806f4

Revision 9952:986e9cd806f4, 977 bytes checked in by Miha Stajdohar <miha.stajdohar@…>, 2 years ago (diff)

Tests moved and renamed from orange 20.

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.