| 44 | } |
| 45 | |
| 46 | TObliviousTreeStructure TFeatureParallelObliviousTreeSearcher::Fit() { |
| 47 | CB_ENSURE(FoldBasedTasks.size() || SingleTaskTarget); |
| 48 | |
| 49 | TMirrorBuffer<ui32> docBins = TMirrorBuffer<ui32>::CopyMapping(DataSet.GetIndices()); |
| 50 | |
| 51 | TTreeUpdater treeUpdater(ScopedCache, |
| 52 | FeaturesManager, |
| 53 | CtrTargets, |
| 54 | DataSet, |
| 55 | docBins); |
| 56 | |
| 57 | TL2Target<NCudaLib::TMirrorMapping> target = ComputeWeakTarget(); |
| 58 | //TODO: two bootstrap type: docs and gathered target |
| 59 | { |
| 60 | auto slices = MakeTaskSlices(); |
| 61 | auto weights = Bootstrap.BootstrappedWeights(GetRandom(), &target.Weights); |
| 62 | //TODO(noxoomo): remove tiny overhead from bootstrap learn also |
| 63 | if (TreeConfig.ObservationsToBootstrap == EObservationsToBootstrap::TestOnly) { |
| 64 | //make learn weights equal to 1 |
| 65 | for (ui32 i = 0, j = 0; i < FoldBasedTasks.size(); ++i, j += 2) { |
| 66 | const auto& learnSlice = slices[j]; |
| 67 | auto learnWeights = weights.SliceView(learnSlice); |
| 68 | FillBuffer(learnWeights, 1.0f); |
| 69 | } |
| 70 | } |
| 71 | MultiplyVector(target.Weights, weights); |
| 72 | MultiplyVector(target.WeightedTarget, weights); |
| 73 | } |
| 74 | |
| 75 | auto subsets = CreateSubsets(TreeConfig.MaxDepth, |
| 76 | target); |
| 77 | |
| 78 | auto observationIndices = TMirrorBuffer<ui32>::CopyMapping(subsets.Indices); |
| 79 | TMirrorBuffer<ui32> directObservationIndices; |
| 80 | if (DataSet.HasPermutationDependentFeatures()) { |
| 81 | directObservationIndices = TMirrorBuffer<ui32>::CopyMapping(subsets.Indices); |
| 82 | } |
| 83 | const ui32 foldCount = subsets.FoldCount; |
| 84 | |
| 85 | //score helpers will do all their job in own stream, so don't forget device-sync for the |
| 86 | using TScoreCaclerPtr = THolder<TScoresCalcerOnCompressedDataSet<>>; |
| 87 | TScoreCaclerPtr featuresScoreCalcer; |
| 88 | TScoreCaclerPtr simpleCtrScoreCalcer; |
| 89 | |
| 90 | if (DataSet.HasFeatures()) { |
| 91 | featuresScoreCalcer = MakeHolder<TScoresCalcerOnCompressedDataSet<>>(DataSet.GetFeatures(), |
| 92 | TreeConfig, |
| 93 | foldCount, |
| 94 | true); |
| 95 | } |
| 96 | if (DataSet.HasPermutationDependentFeatures()) { |
| 97 | simpleCtrScoreCalcer = MakeHolder<TScoresCalcerOnCompressedDataSet<>>(DataSet.GetPermutationFeatures(), |
| 98 | TreeConfig, |
| 99 | foldCount, |
| 100 | true); |
| 101 | } |
| 102 | |
| 103 | TObliviousTreeStructure result; |
nothing calls this directly
no test coverage detected