| 104 | |
| 105 | |
| 106 | ui32 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 | |
| 154 | static inline ui32 UpdateCheckSumImpl(ui32 init, const TNonSymmetricTreeStepNode& node) { |
| 155 | return UpdateCheckSum( |
no test coverage detected