Commit 10228589 authored by Philipp  Trunschke's avatar Philipp Trunschke
Browse files

colorize warnings

parent 273183bf
Pipeline #2149 failed with stages
in 4 minutes and 20 seconds
......@@ -358,7 +358,7 @@ namespace xerus { namespace uq {
REQUIRE(U.order() == 2, "IE");
if (U.dimensions[0] != U.dimensions[1]) {
REQUIRE(U.dimensions[0] > U.dimensions[1], "IE");
std::cout << "WARNING: Real rank(" << pos-2 << ") is " << U.dimensions[1] << " and not " << U.dimensions[0] << '\n';
std::cout << Foreground::Alert + "WARNING: Real rank(" << pos-2 << ") is " << U.dimensions[1] << " and not " << U.dimensions[0] << Foreground::Reset + "\n";
}
contract(next_core, next_core, U, 1);
......@@ -452,7 +452,7 @@ namespace xerus { namespace uq {
REQUIRE(Vt.order() == 2, "IE");
if (Vt.dimensions[0] != Vt.dimensions[1]) {
REQUIRE(Vt.dimensions[0] < Vt.dimensions[1], "IE");
std::cout << "WARNING: Real rank(" << pos+1 << ") is " << Vt.dimensions[0] << " and not " << Vt.dimensions[1] << std::endl;
std::cout << Foreground::Alert + "WARNING: Real rank(" << pos+1 << ") is " << Vt.dimensions[0] << " and not " << Vt.dimensions[1] << Foreground::Reset + "\n";
}
contract(next_core, Vt, next_core, 1);
......@@ -1170,14 +1170,13 @@ namespace xerus { namespace uq {
}
void SALSA::run() {
//TODO: let run() return the optimal state and allow initialization with a given state
LOG(debug, "Entering run()");
REQUIRE(omegaFactor > 0.0, "omegaFactor must be positive");
REQUIRE(alphaFactor >= 0.0, "alphaFactor must be non-negative");
print_parameters();
if (misc::hard_equal(alphaFactor, 0.0)) {
std::cout << "WARNING: Optimizing without l1 regularization" << std::endl;
if (!misc::hard_equal(alphaFactor, 0.0)) {
std::cout << Foreground::Alert + "WARNING: Optimizing with l1 regularization is an experimental feature" + Foreground::Reset + "\n";
}
initialize();
......@@ -1257,14 +1256,14 @@ namespace xerus { namespace uq {
const auto reset = attr(0);
const auto bold = attr(1);
if (improvement) { std::cout << bold; }
std::cout << "[" << iteration << "] Costs:"
<< " LS=" << update_str(bestTrainingResidual , trainingResiduals.back())
<< u8", R\u03B1=" << update_str(bestAlphaCosts, alphaCosts)
<< u8", R\u03C9=" << update_str(bestOmegaCosts, omegaCosts)
<< " | Validation: " << update_str(bestState.validationResidual , validationResiduals.back())
<< " | \u03C9: " << string_format("%.2e", omega)
<< " | Densities: " << print_densities()
<< " | Ranks: " << print_fractional_ranks() << reset << std::endl; // Flush to ensure that the user does not have to wait for other sweeps to complete
std::cout << "[" << iteration << "] Costs:"
<< " LS=" << update_str(bestTrainingResidual , trainingResiduals.back())
<< u8", R\u03B1=" << update_str(bestAlphaCosts, alphaCosts)
<< u8", R\u03C9=" << update_str(bestOmegaCosts, omegaCosts)
<< " | Validation: " << update_str(bestState.validationResidual , validationResiduals.back())
<< " | \u03C9: " << string_format("%.2e", omega)
<< " | Densities: " << print_densities()
<< " | Ranks: " << print_fractional_ranks() << reset << std::endl; // Flush to ensure that the user does not have to wait for other sweeps to complete
};
print_update(true);
......@@ -1346,8 +1345,8 @@ namespace xerus { namespace uq {
//TODO: use disp_shortest_unequal(self.alpha, alpha)
std::cout << "Reduce \u03B1: " << string_format("%.3f", prev_alpha)
<< std::string(u8" \u2192 ")
<< string_format("%.3f", alpha) << std::endl;
<< std::string(u8" \u2192 ")
<< string_format("%.3f", alpha) << std::endl;
} else { REQUIRE(misc::hard_equal(alpha, 0.0), "IE"); }
// clear buffers to ensure that they contain only values for the current choice of alpha
......@@ -1361,8 +1360,8 @@ namespace xerus { namespace uq {
}
std::cout << "Best validation residual in iteration " << bestIteration << ".\n"
<< std::string(125, '-') << '\n'
<< "Truncating inactive singular values." << std::endl;
<< std::string(125, '-') << '\n'
<< "Truncating inactive singular values." << std::endl;
size_t rank;
for (size_t m=0; m<M-1; ++m) {
......@@ -1370,7 +1369,7 @@ namespace xerus { namespace uq {
if (singularValues[m][rank] <= smin) break;
}
if (rank > maxRanks[m]) {
std::cout << "WARNING: maxRanks[" << m << "] = " << maxRanks[m] << " was reached during optimization.\n";
std::cout << Foreground::Alert + "WARNING: maxRanks[" << m << "] = " << maxRanks[m] << " was reached during optimization." + Foreground::Reset + "\n";
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment