Spaces:
Runtime error
Runtime error
ajitrajasekharan
commited on
Commit
·
aeefa6b
1
Parent(s):
a69e30b
Update aggregate_server_json.py
Browse files- aggregate_server_json.py +7 -7
aggregate_server_json.py
CHANGED
@@ -202,13 +202,13 @@ class AggregateNER:
|
|
202 |
mean_score = 1.0/len(dist) #input is a prob distriubution. so sum is 1
|
203 |
else:
|
204 |
mean_score = 0
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
threshold = mean_score
|
212 |
pick_count = 1
|
213 |
for node in dist:
|
214 |
if (node["confidence"] >= threshold):
|
|
|
202 |
mean_score = 1.0/len(dist) #input is a prob distriubution. so sum is 1
|
203 |
else:
|
204 |
mean_score = 0
|
205 |
+
sum_deviation = 0
|
206 |
+
for node in dist:
|
207 |
+
sum_deviation += (mean_score - node["confidence"])*(mean_score - node["confidence"])
|
208 |
+
variance = sum_deviation/len(dist)
|
209 |
+
std_dev = math.sqrt(variance)
|
210 |
+
threshold = mean_score + std_dev*self.threshold #default is 1 standard deviation from mean
|
211 |
+
#threshold = mean_score
|
212 |
pick_count = 1
|
213 |
for node in dist:
|
214 |
if (node["confidence"] >= threshold):
|