void ImbalanceMetrics<scalar_t>::printLine(std::ostream &os) const { std::string label( this->getName() ); if (mcnorm_ > 0){ multiCriteriaNorm realNorm = multiCriteriaNorm(mcnorm_ - 1); std::ostringstream oss; switch (realNorm) { case normMinimizeTotalWeight: // 1-norm = Manhattan norm oss << this->getName() << " (1)"; break; case normBalanceTotalMaximum: // 2-norm = sqrt of sum of squares oss << this->getName() << " (2)"; break; case normMinimizeMaximumWeight: // inf-norm = maximum norm oss << this->getName() << " (inf)"; break; default: oss << this->getName() << " (?)"; break; } label = oss.str(); } os << std::setw(20) << label; os << std::setw(11) << std::setprecision(4) << this->getMetricValue("global minimum"); os << std::setw(11) << std::setprecision(4) << this->getMetricValue("global maximum"); os << std::setw(11) << std::setprecision(4) << this->getMetricValue("global average"); os << std::setw(2) << " "; os << std::setw(10) << std::setprecision(4) << this->getMetricValue("maximum imbalance"); os << std::endl; }
void MetricValues<scalar_t>::printLine(ostream &os) const { string label(metricName_); if (mcnorm_ > 0){ multiCriteriaNorm realNorm = multiCriteriaNorm(mcnorm_ - 1); ostringstream oss; switch (realNorm){ case normMinimizeTotalWeight: // 1-norm = Manhattan norm oss << metricName_ << " (1)"; break; case normBalanceTotalMaximum: // 2-norm = sqrt of sum of squares oss << metricName_ << " (2)"; break; case normMinimizeMaximumWeight: // inf-norm = maximum norm oss << metricName_ << " (inf)"; break; default: oss << metricName_ << " (?)"; break; } label = oss.str(); } os << setw(20) << label; os << setw(12) << setprecision(4) << values_[evalGlobalMin]; os << setw(12) << setprecision(4) << values_[evalGlobalMax]; os << setw(12) << setprecision(4) << values_[evalGlobalAvg]; os << setw(2) << " "; os << setw(6) << setprecision(4) << values_[evalMinImbalance]; os << setw(6) << setprecision(4) << values_[evalMaxImbalance]; os << setw(6) << setprecision(4) << values_[evalAvgImbalance]; os << endl; }
/*! \brief Get the norm. */ multiCriteriaNorm getNorm() { return multiCriteriaNorm(mcnorm_-1);}
/*! \brief Set or reset the norm. */ void setNorm(multiCriteriaNorm normVal) { mcnorm_ = multiCriteriaNorm(normVal+1);}
/*! \brief Constructor */ ImbalanceMetrics() : BaseClassMetrics<scalar_t>(static_metricNames_.size()), mcnorm_(multiCriteriaNorm(0)) {}
/*! \brief Constructor */ MetricValues() : values_(), metricName_("unset"), mcnorm_(multiCriteriaNorm(0)) { resetValues();}
/*! \brief Constructor */ MetricValues(string mname) : values_(), metricName_(mname), mcnorm_(multiCriteriaNorm(0)) { resetValues();}