GEGELATI
Loading...
Searching...
No Matches
laLogger.h
1
39#ifndef LA_LOGGER_H
40#define LA_LOGGER_H
41
42#include <chrono>
43#include <map>
44#include <ostream>
45
46#include "learn/evaluationResult.h"
47#include "log/logger.h"
48#include "tpg/tpgGraph.h"
49
50namespace Learn {
51 class LearningAgent;
52}
53
54namespace Log {
55
65 class LALogger : public Logger
66 {
67 protected:
72 std::shared_ptr<std::chrono::time_point<
73 std::chrono::system_clock, std::chrono::nanoseconds>> const start;
74
79 std::shared_ptr<std::chrono::time_point<std::chrono::system_clock,
80 std::chrono::nanoseconds>>
82
87 double mutationTime = 0;
88
93 double evalTime = 0;
94
99 double validTime = 0;
100
105 double decimationTime = 0;
106
109
116 double getDurationFrom(
117 const std::chrono::time_point<std::chrono::system_clock,
118 std::chrono::nanoseconds>& begin)
119 const;
120
126 std::chrono::time_point<std::chrono::system_clock,
127 std::chrono::nanoseconds>
128 getTime() const;
129
130 public:
134 bool doValidation = false;
135
140 bool useUtility = false;
141
144 bool detailedTiming = false;
145
158 explicit LALogger(Learn::LearningAgent& la,
159 std::ostream& out = std::cout);
160
164 void chronoFromNow();
165
169 virtual void logHeader() {
170 /* Empty because sub-class does not need to inherrit from it.*/
171 };
172
180 virtual void logNewGeneration(uint64_t& generationNumber) {
181 /* Empty because sub-class does not need to inherrit from it.*/
182 };
183
189 virtual void logAfterPopulateTPG() {
190 /* Empty because sub-class does not need to inherrit from it.*/
191 };
192
200 virtual void logAfterEvaluate(
201 std::multimap<std::shared_ptr<Learn::EvaluationResult>,
202 const TPG::TPGVertex*>& results) {
203 /* Empty because sub-class does not need to inherrit from it.*/
204 };
205
210 virtual void logAfterDecimate() {
211 /* Empty because sub-class does not need to inherrit from it.*/
212 };
213
220 virtual void logAfterValidate(
221 std::multimap<std::shared_ptr<Learn::EvaluationResult>,
222 const TPG::TPGVertex*>& results) {
223 /* Empty because sub-class does not need to inherrit from it.*/
224 };
225
229 virtual void logEndOfTraining() {
230 /* Empty because sub-class does not need to inherrit from it.*/
231 };
232 };
233} // namespace Log
234
235#endif
Class used to control the learning steps of a TPGGraph within a given LearningEnvironment.
Definition learningAgent.h:67
Learning Agent logger class that will be called during LearningAgent executions.
Definition laLogger.h:66
double mutationTime
Definition laLogger.h:87
std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > getTime() const
Gets the current time value, for example to set checkpoint.
Definition laLogger.cpp:48
bool useUtility
Definition laLogger.h:140
virtual void logAfterPopulateTPG()
Method called by the Learning Agent right after PopulateTPG is done.
Definition laLogger.h:189
bool detailedTiming
Boolean telling the logger if the training has additional timers.
Definition laLogger.h:144
void chronoFromNow()
Updates checkpoint to now.
Definition laLogger.cpp:63
double validTime
Definition laLogger.h:99
virtual void logEndOfTraining()
Method called by the Learning Agent when the training is done.
Definition laLogger.h:229
Learn::LearningAgent & learningAgent
LearningAgent logged by the LALogger.
Definition laLogger.h:108
virtual void logNewGeneration(uint64_t &generationNumber)
Method called by the LearningAgent at the start of a generation.
Definition laLogger.h:180
virtual void logAfterEvaluate(std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)
Method called by the Learning Agent right after the evaluation is done.
Definition laLogger.h:200
virtual void logAfterDecimate()
Method called by the Learning Agent right after the decimation is done.
Definition laLogger.h:210
LALogger(Learn::LearningAgent &la, std::ostream &out=std::cout)
Constructor defining a given output and setting start and checkpoint as now. Default output is cout.
Definition laLogger.cpp:53
double getDurationFrom(const std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > &begin) const
Computes the duration from a given time to now.
Definition laLogger.cpp:40
virtual void logAfterValidate(std::multimap< std::shared_ptr< Learn::EvaluationResult >, const TPG::TPGVertex * > &results)
Method called by the Learning Agent right after the validation is done.
Definition laLogger.h:220
double decimationTime
Definition laLogger.h:105
std::shared_ptr< std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > > const start
Definition laLogger.h:73
std::shared_ptr< std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > > checkpoint
Definition laLogger.h:81
bool doValidation
Definition laLogger.h:134
double evalTime
Definition laLogger.h:93
virtual void logHeader()
Logs the header (e.g. column names) of this logger.
Definition laLogger.h:169
Definition logger.h:48
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition classificationLearningEnvironment.h:44
Definition cycleDetectionLALogger.h:38