Skip to content

Commit c7e78a0

Browse files
authored
[ML] Fix the train model per loop run time estimate (#889)
1 parent 48a0c6c commit c7e78a0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/maths/CBoostedTreeImpl.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ void CBoostedTreeImpl::train(core::CDataFrame& frame,
494494
TMeanVarAccumulator timeAccumulator;
495495
core::CStopWatch stopWatch;
496496
stopWatch.start();
497+
std::uint64_t lastLap{stopWatch.lap()};
497498

498499
// Hyperparameter optimisation loop.
499500

@@ -523,7 +524,9 @@ void CBoostedTreeImpl::train(core::CDataFrame& frame,
523524
this->recordState(recordTrainStateCallback);
524525
LOG_TRACE(<< "Round " << m_CurrentRound << " state recording finished");
525526

526-
timeAccumulator.add(static_cast<double>(stopWatch.lap()));
527+
std::uint64_t currentLap{stopWatch.lap()};
528+
timeAccumulator.add(static_cast<double>(currentLap - lastLap));
529+
lastLap = currentLap;
527530
}
528531

529532
LOG_TRACE(<< "Test loss = " << m_BestForestTestLoss);

0 commit comments

Comments
 (0)