| 246 | } |
| 247 | |
| 248 | TRawObjectsDataProvider CreateRawObjectsDataProvider( |
| 249 | const TVector<TVector<float>>& srcFloatFeatures, |
| 250 | const TVector<TVector<ui32>>& srcCatFeatures, |
| 251 | const TVector<THashMap<ui32, TString>>& catFeaturesHashToString, |
| 252 | const TCommonObjectsData& commonData, |
| 253 | std::pair<bool, bool> useFeatureTypes, |
| 254 | NPar::ILocalExecutor* localExecutor |
| 255 | ) { |
| 256 | TRawObjectsData data; |
| 257 | ui32 featureId = 0; |
| 258 | |
| 259 | TVector<ui32> catFeatureIndices; |
| 260 | |
| 261 | if (useFeatureTypes.first) { |
| 262 | InitFeatures(srcFloatFeatures, *commonData.SubsetIndexing, &featureId, &data.FloatFeatures); |
| 263 | } |
| 264 | TCommonObjectsData commonDataCopy = commonData; |
| 265 | if (useFeatureTypes.second) { |
| 266 | ui32 catFeaturesIndicesStart = featureId; |
| 267 | |
| 268 | commonDataCopy.CatFeaturesHashToString = MakeAtomicShared<TVector<THashMap<ui32, TString>>>( |
| 269 | catFeaturesHashToString |
| 270 | ); |
| 271 | InitFeatures(srcCatFeatures, *commonData.SubsetIndexing, &featureId, &data.CatFeatures); |
| 272 | |
| 273 | for (ui32 idx : xrange(catFeaturesIndicesStart, featureId)) { |
| 274 | catFeatureIndices.push_back(idx); |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | TFeaturesLayout featuresLayout(featureId, catFeatureIndices, {}, {}, {}); |
| 279 | commonDataCopy.FeaturesLayout = MakeIntrusive<TFeaturesLayout>(featuresLayout); |
| 280 | |
| 281 | return TRawObjectsDataProvider( |
| 282 | Nothing(), |
| 283 | std::move(commonDataCopy), |
| 284 | std::move(data), |
| 285 | /*skipCheck*/ false, |
| 286 | localExecutor |
| 287 | ); |
| 288 | } |
| 289 | |
| 290 | using TCatHashToString = std::pair<ui32, TString>; |
| 291 | |