Added time measurement
This commit is contained in:
parent
24b6969ab7
commit
22dba2cb27
@ -1,10 +1,14 @@
|
||||
#include "netlearner.h"
|
||||
#include "../../Net.h"
|
||||
|
||||
#include <QElapsedTimer>
|
||||
|
||||
void NetLearner::run()
|
||||
{
|
||||
try
|
||||
{
|
||||
QElapsedTimer timer;
|
||||
|
||||
Net myNet({2, 3, 1});
|
||||
|
||||
size_t batchSize = 5000;
|
||||
@ -12,6 +16,8 @@ void NetLearner::run()
|
||||
double batchMaxError = 0.0;
|
||||
double batchMeanError = 0.0;
|
||||
|
||||
timer.start();
|
||||
|
||||
size_t numIterations = 1000000;
|
||||
for (size_t iteration = 0; iteration < numIterations; ++iteration)
|
||||
{
|
||||
@ -59,6 +65,13 @@ void NetLearner::run()
|
||||
emit progress((double)iteration / (double)numIterations);
|
||||
}
|
||||
|
||||
QString timerLogString;
|
||||
timerLogString.append("Elapsed time: ");
|
||||
timerLogString.append(QString::number(timer.elapsed() / 1000.0));
|
||||
timerLogString.append(" seconds");
|
||||
|
||||
emit logMessage(timerLogString);
|
||||
|
||||
myNet.save("mynet.nnet");
|
||||
}
|
||||
catch (std::exception &ex)
|
||||
|
Reference in New Issue
Block a user