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

Method BuildDataSet

catboost/cuda/gpu_data/doc_parallel_dataset_builder.cpp:20–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20NCatboostCuda::TDocParallelDataSetsHolder NCatboostCuda::TDocParallelDataSetBuilder::BuildDataSet(const ui32 permutationCount,
21 NPar::ILocalExecutor* localExecutor) {
22 TDocParallelDataSetsHolder dataSetsHolder(DataProvider,
23 FeaturesManager,
24 LinkedTest);
25
26 TSharedCompressedIndexBuilder<TDataSetLayout> compressedIndexBuilder(*dataSetsHolder.CompressedIndex,
27 localExecutor);
28
29 dataSetsHolder.PermutationDataSets.resize(permutationCount);
30
31 //
32 TDataPermutation learnLoadBalancingPermutation = dataSetsHolder.LearnDocPerDevicesSplit->Permutation;
33
34 TCudaBuffer<float, NCudaLib::TStripeMapping> targets;
35 TCudaBuffer<float, NCudaLib::TStripeMapping> weights;
36
37 const auto cpuTargets = *DataProvider.TargetData->GetTarget();
38 const auto targetCount = cpuTargets.size();
39 targets.Reset(dataSetsHolder.LearnDocPerDevicesSplit->Mapping, targetCount);
40 weights.Reset(dataSetsHolder.LearnDocPerDevicesSplit->Mapping);
41
42 targets.Write(Flatten2D(learnLoadBalancingPermutation.Gather2D(*DataProvider.TargetData->GetTarget())));
43 weights.Write(learnLoadBalancingPermutation.Gather(GetWeights(*DataProvider.TargetData)));
44
45 for (ui32 permutationId = 0; permutationId < permutationCount; ++permutationId) {
46 dataSetsHolder.PermutationDataSets[permutationId] = THolder<TDocParallelDataSet>(new TDocParallelDataSet(DataProvider,
47 dataSetsHolder.CompressedIndex,
48 GetPermutation(DataProvider, permutationId),
49 learnLoadBalancingPermutation,
50 dataSetsHolder.LearnDocPerDevicesSplit->SamplesGrouping,
51 TTarget<NCudaLib::TStripeMapping>(targets.ConstCopyView(),
52 weights.ConstCopyView(),
53 /*isPairWeights*/ false)));
54 }
55
56 if (LinkedTest != nullptr) {
57 TCudaBuffer<float, NCudaLib::TStripeMapping> testTargets;
58 TCudaBuffer<float, NCudaLib::TStripeMapping> testWeights;
59
60 TDataPermutation testLoadBalancingPermutation = dataSetsHolder.TestDocPerDevicesSplit->Permutation;
61
62 testTargets.Reset(dataSetsHolder.TestDocPerDevicesSplit->Mapping, targetCount);
63 testWeights.Reset(dataSetsHolder.TestDocPerDevicesSplit->Mapping);
64
65 testTargets.Write(Flatten2D(testLoadBalancingPermutation.Gather2D(*LinkedTest->TargetData->GetTarget())));
66 testWeights.Write(testLoadBalancingPermutation.Gather(GetWeights(*LinkedTest->TargetData)));
67
68 dataSetsHolder.TestDataSet = THolder<TDocParallelDataSet>(new TDocParallelDataSet(*LinkedTest,
69 dataSetsHolder.CompressedIndex,
70 GetIdentityPermutation(*LinkedTest),
71 testLoadBalancingPermutation,
72 dataSetsHolder.TestDocPerDevicesSplit->SamplesGrouping,
73 TTarget<NCudaLib::TStripeMapping>(testTargets.ConstCopyView(),
74 testWeights.ConstCopyView(),
75 /*isPairWeights*/ false)));
76 }
77

Callers 10

TestDatasetHolderBuilderFunction · 0.45
TestTreeBuilderFunction · 0.45
CreateDataSetMethod · 0.45
TestPairwiseHistFunction · 0.45
TestPointwiseHistFunction · 0.45
TestSplitPropsHelperFunction · 0.45

Calls 15

Flatten2DFunction · 0.85
GetPermutationFunction · 0.85
GetIdentityPermutationFunction · 0.85
Gather2DMethod · 0.80
GatherMethod · 0.80
ConstCopyViewMethod · 0.80
GetMappingMethod · 0.80
FillOrderMethod · 0.80
AddDataSetMethod · 0.80
GetCtrsCountMethod · 0.80

Tested by 8

TestDatasetHolderBuilderFunction · 0.36
TestTreeBuilderFunction · 0.36
TestPairwiseHistFunction · 0.36
TestPointwiseHistFunction · 0.36
TestSplitPropsHelperFunction · 0.36