GEGELATI
Loading...
Searching...
No Matches
laLogger.h
1
38#ifndef LA_LOGGER_H
39#define LA_LOGGER_H
40
41#include <chrono>
42#include <map>
43#include <ostream>
44
45#include "learn/evaluationResult.h"
46#include "log/logger.h"
47#include "tpg/tpgGraph.h"
48
49namespace Learn {
50 class LearningAgent;
51}
52
53namespace Log {
54
64 class LALogger : public Logger
65 {
66 protected:
71 std::shared_ptr<std::chrono::time_point<
72 std::chrono::system_clock, std::chrono::nanoseconds>> const start;
73
78 std::shared_ptr<std::chrono::time_point<std::chrono::system_clock,
79 std::chrono::nanoseconds>>
81
86 double mutationTime = 0;
87
92 double evalTime = 0;
93
98 double validTime = 0;
99
104 double decimationTime = 0;
105
108
115 double getDurationFrom(
116 const std::chrono::time_point<std::chrono::system_clock,
117 std::chrono::nanoseconds>& begin)
118 const;
119
125 std::chrono::time_point<std::chrono::system_clock,
126 std::chrono::nanoseconds>
127 getTime() const;
128
129 public:
133 bool doValidation = false;
134
139 bool useUtility = false;
140
143 bool detailedTiming = false;
144
157 explicit LALogger(Learn::LearningAgent& la,
158 std::ostream& out = std::cout);
159
163 void chronoFromNow();
164
168 virtual void logHeader() {
169 /* Empty because sub-class does not need to inherrit from it.*/
170 };
171
179 virtual void logNewGeneration(uint64_t& generationNumber) {
180 /* Empty because sub-class does not need to inherrit from it.*/
181 };
182
188 virtual void logAfterPopulateTPG() {
189 /* Empty because sub-class does not need to inherrit from it.*/
190 };
191
199 virtual void logAfterEvaluate(
200 std::multimap<std::shared_ptr<Learn::EvaluationResult>,
201 const TPG::TPGVertex*>& results) {
202 /* Empty because sub-class does not need to inherrit from it.*/
203 };
204
209 virtual void logAfterDecimate() {
210 /* Empty because sub-class does not need to inherrit from it.*/
211 };
212
219 virtual void logAfterValidate(
220 std::multimap<std::shared_ptr<Learn::EvaluationResult>,
221 const TPG::TPGVertex*>& results) {
222 /* Empty because sub-class does not need to inherrit from it.*/
223 };
224
228 virtual void logEndOfTraining() {
229 /* Empty because sub-class does not need to inherrit from it.*/
230 };
231 };
232} // namespace Log
233
234#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:65
double mutationTime
Definition laLogger.h:86
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:139
virtual void logAfterPopulateTPG()
Method called by the Learning Agent right after PopulateTPG is done.
Definition laLogger.h:188
bool detailedTiming
Boolean telling the logger if the training has additional timers.
Definition laLogger.h:143
void chronoFromNow()
Updates checkpoint to now.
Definition laLogger.cpp:63
double validTime
Definition laLogger.h:98
virtual void logEndOfTraining()
Method called by the Learning Agent when the training is done.
Definition laLogger.h:228
Learn::LearningAgent & learningAgent
LearningAgent logged by the LALogger.
Definition laLogger.h:107
virtual void logNewGeneration(uint64_t &generationNumber)
Method called by the LearningAgent at the start of a generation.
Definition laLogger.h:179
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:199
virtual void logAfterDecimate()
Method called by the Learning Agent right after the decimation is done.
Definition laLogger.h:209
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:219
double decimationTime
Definition laLogger.h:104
std::shared_ptr< std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > > const start
Definition laLogger.h:72
std::shared_ptr< std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > > checkpoint
Definition laLogger.h:80
bool doValidation
Definition laLogger.h:133
double evalTime
Definition laLogger.h:92
virtual void logHeader()
Logs the header (e.g. column names) of this logger.
Definition laLogger.h:168
Definition logger.h:48
Abstract class representing the vertices of a TPGGraph.
Definition tpgVertex.h:55
Definition classificationLearningEnvironment.h:44
Definition cycleDetectionLALogger.h:38