source: orange/Orange/doc/modules/outlier2.py @ 9671:a7b056375472

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

Moved orange to Orange (part 2)

Line 
1# Description: Shows how to use outlier detection
2# Category:    Outlier detection
3# Classes:     orngOutlier
4# Uses:        bridges
5# Referenced:  OutlierDetection.htm
6
7try: 
8    import pstat, stats
9except:
10    print "Could not import library pstat or stats!"
11else:
12    import orange, orngOutlier
13
14    data = orange.ExampleTable("bridges")
15    outlierDet = orngOutlier.OutlierDetection()
16    outlierDet.setExamples(data, orange.ExamplesDistanceConstructor_Euclidean(data))
17    outlierDet.setKNN(3)
18    zValues = outlierDet.zValues()
19    sorted = []
20    for el in zValues: sorted.append(el)
21    sorted.sort()
22    for i,el in enumerate(zValues):
23        if el > sorted[-6]: print  data[i], "Z-score: %5.3f" % el
Note: See TracBrowser for help on using the repository browser.