1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
//
// f1score.cpp
// Mothur
//
// Created by Sarah Westcott on 4/11/17.
// Copyright © 2017 Schloss Lab. All rights reserved.
//
#include "f1score.hpp"
/***********************************************************************/
double F1Score::getValue(double tp, double tn, double fp, double fn) {
try {
long long p = 2.0 * tp;
long long pPrime = fn + fp;
double f1Score = 2.0 * tp / (double) (p + pPrime);
if(p + pPrime == 0) { f1Score = 0; }
if (isnan(f1Score) || isinf(f1Score)) { f1Score = 0; }
return f1Score;
}
catch(exception& e) {
m->errorOut(e, "F1Score", "getValue");
exit(1);
}
}
/***********************************************************************/
|