void PrecisionRecallM::print() { std::cout << s << " (precision recall F1 n) = " << getPrecision() << " " << getRecall() << " " << getF1() << " " << (size/n) << std::endl; }
double TwoClassStats::getFMeasure() const { double precision = getPrecision(); double recall = getRecall(); if ((precision + recall) == 0) { return 0; } return 2 * precision * recall / (precision + recall); }
string TwoClassStats::toString() const { string res = ""; res.append(std::to_string(getTruePositive())).append(" "); res.append(std::to_string(getFalseNegative())).append(" "); res.append(std::to_string(getTrueNegative())).append(" "); res.append(std::to_string(getFalsePositive())).append(" "); res.append(std::to_string(getFalsePositiveRate())).append(" "); res.append(std::to_string(getTruePositiveRate())).append(" "); res.append(std::to_string(getPrecision())).append(" "); res.append(std::to_string(getRecall())).append(" "); res.append(std::to_string(getFMeasure())).append(" "); res.append(std::to_string(getFallout())).append(" "); return res; }
double getFMeasure(double beta) const { double betaSquared = beta * beta; double precision = getPrecision(); double recall = getRecall(); return ((1 + betaSquared) * precision * recall) / (betaSquared * precision + recall); }