source: orange/orange/doc/modules/outlier2.py @ 3784:e96b3c7cdf37

Revision 3784:e96b3c7cdf37, 669 bytes checked in by markotoplak, 7 years ago (diff)

Moved outlier detection from reference section.

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.