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

Method DataProviderSamplerReorderByIndices

catboost/libs/data/sampler.cpp:108–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106
107
108TDataProviderPtr NCB::DataProviderSamplerReorderByIndices(
109 const TDataProviderSampleParams& params,
110 TDataProviderPtr dataProvider,
111 TConstArrayRef<ui32> indices
112) {
113 // resort dataset according to original indices
114 TVector<ui32> currentOrder(indices.size());
115 Iota(currentOrder.begin(), currentOrder.end(), ui32(0));
116 Sort(currentOrder, [&](ui32 l, ui32 r) { return indices[l] < indices[r]; });
117 TVector<ui32> finalOrder(indices.size());
118 for (size_t i : xrange(indices.size())) {
119 finalOrder[currentOrder[i]] = i;
120 }
121
122 if (params.OnlyFeaturesData) {
123 DegroupDataset(dataProvider.Get());
124 }
125
126 return dataProvider->GetSubset(
127 GetGroupingSubsetFromObjectsSubset(
128 dataProvider->ObjectsGrouping,
129 finalOrder,
130 EObjectsOrder::RandomShuffled
131 ),
132 params.CpuUsedRamLimit,
133 params.LocalExecutor
134 );
135}
136
137
138TDataProviderPtr NCB::LinesFileSampleByIndices(const TDataProviderSampleParams& params, TConstArrayRef<ui32> indices) {

Callers

nothing calls this directly

Calls 10

IotaFunction · 0.85
xrangeFunction · 0.85
DegroupDatasetFunction · 0.85
SortFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetMethod · 0.45
GetSubsetMethod · 0.45

Tested by

no test coverage detected