19 Gauge(std::string preText,
int totalIndexes,
int currIndex = 0) {
20 this->totalIndexes = totalIndexes;
21 this->currIndex = currIndex;
22 this->preText = preText;
40 std::string ratioStr = std::to_string(this->currIndex) +
"/" +
41 std::to_string(this->totalIndexes);
42 float ratio =
static_cast<float>(this->currIndex) / this->totalIndexes;
43 Element document = hbox({
50 Screen::Create(Dimension::Fixed(100), Dimension::Fit(document));
51 Render(screen, document);
52 std::cout << this->resetPos;
54 this->resetPos = screen.ResetPosition();
61 TrainingGauge(
int totalIndexes,
int currIndex = 0,
int totalEpochs = 10,
63 :
Gauge(
"Training : ", totalIndexes, currIndex) {
64 this->totalEpochs = totalEpochs;
65 this->currEpoch = currEpoch;
68 void printWithLoss(
double l) {
70 std::string ratioStr = std::to_string(this->currIndex) +
"/" +
71 std::to_string(this->totalIndexes);
72 std::string epochStr =
"Epoch : " + std::to_string(this->currEpoch) +
"/" +
73 std::to_string(this->totalEpochs);
74 std::string errorStr =
"Loss : " + std::to_string(
static_cast<float>(l));
75 float ratio =
static_cast<float>(this->currIndex) / this->totalIndexes;
83 text(errorStr) | border});
85 std::cout << this->resetPos;
87 this->resetPos = screen.ResetPosition();
95 std::string ratioStr = std::to_string(this->currIndex) +
"/" +
96 std::to_string(this->totalIndexes);
97 std::string epochStr =
"Epoch : " + std::to_string(this->currEpoch) +
"/" +
98 std::to_string(this->totalEpochs);
99 std::string errorStr =
"Loss : " + std::to_string(
static_cast<float>(l));
100 std::string accStr =
"Accuracy : " + std::to_string(
static_cast<float>(a));
102 float ratio =
static_cast<float>(this->currIndex) / this->totalIndexes;
106 text(epochStr +
" "),
108 text(
" " + ratioStr),
111 text(errorStr) | border, text(accStr) | border});
113 std::cout << this->resetPos;
115 this->resetPos = screen.ResetPosition();
126 Element document = hbox(elements);
128 Screen screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
130 Render(screen, document);
136 std::string resetPos;