source: orange/orange/doc/reference/pp-duplicates.py @ 526:fe2d65da2b2a

Revision 526:fe2d65da2b2a, 902 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 remove or merge duplicate example
2# Category:    preprocessing, duplicate examples
3# Classes:     Preprocessor, Preprocessor_removeDuplicates, Preprocessor_ignore
4# Uses:        lenses
5# Referenced:  preprocessing.htm
6
7import orange
8data = orange.ExampleTable("lenses")
9age, prescr, astigm, tears, y = data.domain.variables
10
11print "\n\nPreprocessor_removeDuplicates\n"
12
13print "Before removal\n"
14data2 = orange.Preprocessor_ignore(data, attributes = [age])
15for ex in data2:
16    print ex
17
18print "After removal\n"
19data2, weightID = orange.Preprocessor_removeDuplicates(data2)
20# we add a meta attribute so that output is always the same
21# (else, the meta id would depend upon the number of meta attributes
22# constructed, which would trigger suspicions about randomness in testing scripts
23data2.domain.addmeta(weightID, orange.FloatVariable("#"))
24for ex in data2:
25    print ex
26
27
Note: See TracBrowser for help on using the repository browser.