/
loggerlist.h
92 lines (71 loc) · 3.3 KB
/
loggerlist.h
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// ========================================================================== //
// ___. __ //
// ____ ____ _____ ______\_ |__ ____ ____ _______/ |_ //
// _/ ___\/ _ \ / \\____ \| __ \ / _ \ / _ \/ ___/\ __\ //
// \ \__( <_> ) Y Y \ |_> > \_\ ( <_> | <_> )___ \ | | //
// \___ >____/|__|_| / __/|___ /\____/ \____/____ > |__| //
// \/ \/|__| \/ \/ //
// //
// ========================================================================== //
//
// Compboost is free software: you can redistribute it and/or modify
// it under the terms of the MIT License.
// Compboost is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MIT License for more details. You should have received a copy of
// the MIT License along with compboost.
//
// =========================================================================== #
#ifndef LOGGERLIST_H_
#define LOGGERLIST_H_
#include <chrono>
#include <string>
#include <memory>
#include "logger.h"
#include "response.h"
#include "optimizer.h"
typedef std::map<std::string, std::shared_ptr<logger::Logger>> logger_map;
namespace loggerlist
{
class LoggerList
{
private:
logger_map log_list;
unsigned int sum_of_stopper = 0;
public:
LoggerList ();
// LoggerList (arma::mat&, std::chrono::system_clock::time_point, double);
// String for logger and the logger itselfe:
void registerLogger (std::shared_ptr<logger::Logger>);
void printRegisteredLogger () const;
logger_map getMap () const;
void clearMap ();
// This function should iterate over all registered logger, check if it is
// a stopper and returns just one bool, aggregated over a vector of bools
// from the single logger. This could be e.g. one is fullfilled or an all
// check (all stopper has to be fullfilled). The priority comes with the
// map identifier since it sorts the entrys after name.
// If the argument is 'true', than all stopper has to be fullfilled.
bool getStopperStatus (const bool&) const;
// Get a matrix of tracked logger (iterator over all logger and paste
// all columns of the private member). The return is a pair with a
// string vector containing the logger type and a matrix with corresponging
// columns for each logger type:
std::pair<std::vector<std::string>, arma::mat> getLoggerData () const;
// Log the current step (structure <iteration, actual time, actual risk>).
// This is given to the instantiated logger:
void logCurrent (const unsigned int&, std::shared_ptr<response::Response>,
std::shared_ptr<blearner::Baselearner>, const double&, const double&,
std::shared_ptr<optimizer::Optimizer>);
// Print the logger status:
void printLoggerStatus (const double&) const;
// Prepare logger data for retraining:
void prepareForRetraining (const unsigned int&);
// Clear the logger data (should be used in front of every compboost training):
void clearLoggerData ();
// Destructor:
~LoggerList ();
};
} // namespace loggerlist
#endif // LOGGERLIST_H_