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

Method CalcCheckSum

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

Source from the content-addressed store, hash-verified

104
105
106ui32 TFoldsCreationParams::CalcCheckSum(
107 const NCB::TObjectsGrouping& objectsGrouping,
108 NPar::ILocalExecutor* localExecutor) const {
109
110 ui32 checkSum = MultiHash(
111 IsOrderedBoosting,
112 LearningFoldCount,
113 FoldPermutationBlockSize,
114 StoreExpApproxes,
115 HasPairwiseWeights,
116 IsAverageFoldPermuted
117 );
118
119 if (IsOrderedBoosting) {
120 checkSum = MultiHash(checkSum, FoldLenMultiplier);
121 if (!objectsGrouping.IsTrivial()) {
122 const auto groups = objectsGrouping.GetNonTrivialGroups();
123
124 constexpr int GROUP_BLOCK_SIZE = 20000;
125
126 TSimpleIndexRangesGenerator<int> indexRangeGenerator(
127 TIndexRange<int>(SafeIntegerCast<int>(groups.size())),
128 GROUP_BLOCK_SIZE
129 );
130
131 TVector<ui32> groupsBlockCheckSums(SafeIntegerCast<size_t>(indexRangeGenerator.RangesCount()), 0);
132
133 localExecutor->ExecRangeWithThrow(
134 [&, groups] (int blockIdx) {
135 ui32 blockCheckSum = 0;
136 for (auto i : indexRangeGenerator.GetRange(blockIdx).Iter()) {
137 blockCheckSum = MultiHash(blockCheckSum, groups[i].Begin, groups[i].End);
138 }
139 groupsBlockCheckSums[blockIdx] = blockCheckSum;
140 },
141 0,
142 indexRangeGenerator.RangesCount(),
143 NPar::TLocalExecutor::WAIT_COMPLETE
144 );
145
146 for (auto groupsBlockCheckSum : groupsBlockCheckSums) {
147 checkSum = MultiHash(checkSum, groupsBlockCheckSum);
148 }
149 }
150 }
151 return checkSum;
152}
153
154static inline ui32 UpdateCheckSumImpl(ui32 init, const TNonSymmetricTreeStepNode& node) {
155 return UpdateCheckSum(

Callers 1

TLearnContextMethod · 0.45

Calls 8

MultiHashFunction · 0.85
GetNonTrivialGroupsMethod · 0.80
ExecRangeWithThrowMethod · 0.80
IsTrivialMethod · 0.45
sizeMethod · 0.45
RangesCountMethod · 0.45
IterMethod · 0.45
GetRangeMethod · 0.45

Tested by

no test coverage detected