Skip to content

Commit e3ff065

Browse files
authored
Merge pull request MIT-LCP#171 from MIT-LCP/sensitivity
Specificity -> Sensitivity. Fixes MIT-LCP#151.
2 parents 739f951 + d0c0065 commit e3ff065

File tree

3 files changed

+31
-52
lines changed

3 files changed

+31
-52
lines changed

demo.ipynb

Lines changed: 19 additions & 40 deletions
Large diffs are not rendered by default.

tests/test_processing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,6 @@ def test_xqrs(self):
118118
xqrs.qrs_inds,
119119
int(0.1 * fields['fs']))
120120

121-
assert comparitor.specificity > 0.99
121+
assert comparitor.sensitivity > 0.99
122122
assert comparitor.positive_predictivity > 0.99
123123
assert comparitor.false_positive_rate < 0.01

wfdb/processing/evaluate.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def _calc_stats(self):
8181
fp = 10
8282
fn = 30
8383
84-
specificity = 470 / 500
84+
sensitivity = 470 / 500
8585
positive_predictivity = 470 / 480
8686
false_positive_rate = 10 / 480
8787
@@ -111,7 +111,7 @@ def _calc_stats(self):
111111
self.fn = self.n_ref - self.tp
112112
# No tn attribute
113113

114-
self.specificity = float(self.tp) / self.n_ref
114+
self.sensitivity = float(self.tp) / self.n_ref
115115
self.positive_predictivity = float(self.tp) / self.n_test
116116
self.false_positive_rate = float(self.fp) / self.n_test
117117

@@ -243,7 +243,7 @@ def print_summary(self):
243243
self.fn = self.n_ref - self.tp
244244
# No tn attribute
245245

246-
self.specificity = self.tp / self.n_ref
246+
self.sensitivity = self.tp / self.n_ref
247247
self.positive_predictivity = self.tp / self.n_test
248248
self.false_positive_rate = self.fp / self.n_test
249249

@@ -253,8 +253,8 @@ def print_summary(self):
253253
print('False Positives (unmatched test samples: %d' % self.fp)
254254
print('False Negatives (unmatched reference samples): %d\n' % self.fn)
255255

256-
print('Specificity: %.4f (%d/%d)'
257-
% (self.specificity, self.tp, self.n_ref))
256+
print('Sensitivity: %.4f (%d/%d)'
257+
% (self.sensitivity, self.tp, self.n_ref))
258258
print('Positive Predictivity: %.4f (%d/%d)'
259259
% (self.positive_predictivity, self.tp, self.n_test))
260260
print('False Positive Rate: %.4f (%d/%d)'
@@ -400,8 +400,8 @@ def benchmark_mitdb(detector, verbose=False, print_results=False):
400400
comparitors : dictionary
401401
Dictionary of Comparitor objects run on the records, keyed on
402402
the record names.
403-
specificity : float
404-
Aggregate specificity.
403+
sensitivity : float
404+
Aggregate sensitivity.
405405
positive_predictivity : float
406406
Aggregate positive_predictivity.
407407
false_positive_rate : float
@@ -433,7 +433,7 @@ def benchmark_mitdb(detector, verbose=False, print_results=False):
433433
comparitors = p.starmap(benchmark_mitdb_record, args)
434434

435435
# Calculate aggregate stats
436-
specificity = np.mean([c.specificity for c in comparitors])
436+
sensitivity = np.mean([c.sensitivity for c in comparitors])
437437
positive_predictivity = np.mean(
438438
[c.positive_predictivity for c in comparitors])
439439
false_positive_rate = np.mean(
@@ -444,14 +444,14 @@ def benchmark_mitdb(detector, verbose=False, print_results=False):
444444
print('Benchmark complete')
445445

446446
if print_results:
447-
print('\nOverall MITDB Performance - Specificity: %.4f, Positive Predictivity: %.4f, False Positive Rate: %.4f\n'
448-
% (specificity, positive_predictivity, false_positive_rate))
447+
print('\nOverall MITDB Performance - Sensitivity: %.4f, Positive Predictivity: %.4f, False Positive Rate: %.4f\n'
448+
% (sensitivity, positive_predictivity, false_positive_rate))
449449
for record_name in record_list:
450450
print('Record %s:' % record_name)
451451
comparitors[record_name].print_summary()
452452
print('\n\n')
453453

454-
return comparitors, specificity, positive_predictivity, false_positive_rate
454+
return comparitors, sensitivity, positive_predictivity, false_positive_rate
455455

456456

457457
def benchmark_mitdb_record(rec, detector, verbose):

0 commit comments

Comments
 (0)