Skip to content

Commit 4cea833

Browse files
committed
[regressor] add outlier removal
1 parent 98bf813 commit 4cea833

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

regressor.py

+12
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@
3131
metrics = i.split(',')
3232
map2[metrics[0]] = float(metrics[1])
3333

34+
REMOVE_OUTLIERS = True
35+
if REMOVE_OUTLIERS:
36+
for currMap in [map1, map2]:
37+
values = list(currMap.values())
38+
avg = sum(values)/len(values)
39+
std = np.std(values)
40+
THRESHOLD = 3 # 3 standard deviations is considered to be an outlier
41+
for i in list(currMap.keys()):
42+
if abs((currMap[i] - avg)/std) > THRESHOLD:
43+
currMap.pop(i, None)
44+
45+
3446
x = []
3547
y = []
3648

0 commit comments

Comments
 (0)