Skip to content

Commit

Permalink
tnr_ using same cutoff as confusionMatrix_
Browse files Browse the repository at this point in the history
  • Loading branch information
labrax committed Feb 11, 2021
1 parent d3cbb5f commit 8230b81
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/confusionMatrix_.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ double npv_(NumericVector actual, NumericVector predicted, double cutoff) {
// [[Rcpp::export]]
double tnr_(NumericVector actual, NumericVector predicted, double cutoff) {

double TN = sum((predicted < cutoff) & (actual == 0));
double N = sum(actual == 0);
double tnr = TN/N;
NumericMatrix cMat = confusionMatrix_(actual, predicted, cutoff);

double tnr = cMat(0,0) / (cMat(0,0) + cMat(1,0));
return tnr;

}
Expand Down

0 comments on commit 8230b81

Please sign in to comment.