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

Function Shuffle

catboost/cuda/data/data_utils.h:22–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21 template <class TIndicesType>
22 inline void Shuffle(ui64 seed, ui32 blockSize, ui32 sampleCount, TVector<TIndicesType>* orderPtr) {
23 TRandom rng(seed);
24 rng.Advance(10);
25 auto& order = *orderPtr;
26 order.yresize(sampleCount);
27 std::iota(order.begin(), order.end(), 0);
28
29 if (blockSize == 1) {
30 ::Shuffle(order.begin(), order.begin() + sampleCount, rng);
31 } else {
32 const auto blocksCount = static_cast<ui32>(::NHelpers::CeilDivide(order.size(), blockSize));
33 TVector<ui32> blocks;
34 blocks.yresize(blocksCount);
35 std::iota(blocks.begin(), blocks.end(), 0);
36 ::Shuffle(blocks.begin(), blocks.end(), rng);
37
38 ui32 cursor = 0;
39 for (ui32 i = 0; i < blocksCount; ++i) {
40 const ui32 blockStart = blocks[i] * blockSize;
41 const ui32 blockEnd = Min<ui32>(blockStart + blockSize, order.size());
42 for (ui32 j = blockStart; j < blockEnd; ++j) {
43 order[cursor++] = j;
44 }
45 }
46 }
47 }
48
49 template <class TIndicesType>
50 inline void GenerateQueryDocsOrder(ui64 seed, ui32 blockSize, TConstArrayRef<TGroupBounds> groupBounds, TVector<TIndicesType>* orderPtr) {

Callers 15

GenerateQueryDocsOrderFunction · 0.70
FillOrderMethod · 0.70
FillGroupOrderMethod · 0.70
TrainEvalSplitFunction · 0.50
TuneHyperparamsCVFunction · 0.50
TuneHyperparamsTrainTestFunction · 0.50
GenerateBruteForceFunction · 0.50
ShuffleLearnDataIfNeededFunction · 0.50
InitPermutationDataFunction · 0.50
Y_UNIT_TESTFunction · 0.50

Calls 6

yresizeMethod · 0.80
CeilDivideFunction · 0.50
AdvanceMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by 8

TestAucFunction · 0.40
TestBinClassAucFunction · 0.40
Y_UNIT_TESTFunction · 0.40
Y_UNIT_TESTFunction · 0.40
Y_UNIT_TESTFunction · 0.40
Y_UNIT_TESTFunction · 0.40
RunComputeTestFunction · 0.40