MCPcopy Create free account
hub / github.com/catboost/catboost / SaveProgress

Method SaveProgress

catboost/private/libs/algo/learn_context.cpp:359–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357
358
359void TLearnContext::SaveProgress(std::function<void(IOutputStream*)> onSaveSnapshot) {
360 if (!OutputOptions.SaveSnapshot()) {
361 return;
362 }
363 const auto snapshotBackup = Files.SnapshotFile + ".bak";
364 TProgressHelper(ToString(ETaskType::CPU)).Write(
365 snapshotBackup,
366 [&](IOutputStream* out) {
367 onSaveSnapshot(out);
368 ::SaveMany(out, *LearnProgress, Profile.DumpProfileInfo());
369 }
370 );
371 TFsPath(snapshotBackup).ForceRenameTo(Files.SnapshotFile);
372}
373
374bool TLearnContext::TryLoadProgress(std::function<bool(IInputStream*)> onLoadSnapshot) {
375 if (!OutputOptions.SaveSnapshot() || !NFs::Exists(Files.SnapshotFile)) {

Callers 1

TrainFunction · 0.80

Calls 7

TProgressHelperClass · 0.85
SaveManyFunction · 0.85
SaveSnapshotMethod · 0.80
ForceRenameToMethod · 0.80
ToStringFunction · 0.50
TFsPathClass · 0.50
WriteMethod · 0.45

Tested by

no test coverage detected