| 70 | |
| 71 | |
| 72 | static TDataProviders LoadPools( |
| 73 | const TCatBoostOptions& catBoostOptions, |
| 74 | const TPoolLoadParams& poolLoadParams, |
| 75 | TOption<bool>* hasTimeFlag, |
| 76 | NPar::ILocalExecutor* executor |
| 77 | ) { |
| 78 | TVector<NJson::TJsonValue> classLabels = catBoostOptions.DataProcessingOptions->ClassLabels; |
| 79 | const auto objectsOrder = hasTimeFlag->Get() ? EObjectsOrder::Ordered : EObjectsOrder::Undefined; |
| 80 | CB_ENSURE(poolLoadParams.TestSetPaths.size() <= 1, "Features selection mode doesn't support several eval sets."); |
| 81 | const bool haveLearnFeaturesInMemory = HaveFeaturesInMemory( |
| 82 | catBoostOptions, |
| 83 | poolLoadParams.LearnSetPath); |
| 84 | TVector<TDatasetSubset> testDatasetSubsets; |
| 85 | for (const auto& testSetPath : poolLoadParams.TestSetPaths) { |
| 86 | testDatasetSubsets.push_back( |
| 87 | TDatasetSubset::MakeColumns(HaveFeaturesInMemory(catBoostOptions, testSetPath))); |
| 88 | } |
| 89 | auto pools = NCB::ReadTrainDatasets( |
| 90 | catBoostOptions.GetTaskType(), |
| 91 | poolLoadParams, |
| 92 | objectsOrder, |
| 93 | /*readTestData*/true, |
| 94 | TDatasetSubset::MakeColumns(haveLearnFeaturesInMemory), |
| 95 | testDatasetSubsets, |
| 96 | catBoostOptions.DataProcessingOptions->ForceUnitAutoPairWeights, |
| 97 | &classLabels, |
| 98 | executor, |
| 99 | /*profile*/nullptr |
| 100 | ); |
| 101 | CB_ENSURE(pools.Learn != nullptr, "Train data must be provided"); |
| 102 | |
| 103 | const auto learnDataOrder = pools.Learn->ObjectsData->GetOrder(); |
| 104 | if (learnDataOrder == EObjectsOrder::Ordered) { |
| 105 | *hasTimeFlag = true; |
| 106 | } |
| 107 | pools.Learn = ReorderByTimestampLearnDataIfNeeded(catBoostOptions, pools.Learn, executor); |
| 108 | |
| 109 | TRestorableFastRng64 rand(catBoostOptions.RandomSeed); |
| 110 | pools.Learn = ShuffleLearnDataIfNeeded(catBoostOptions, pools.Learn, executor, &rand); |
| 111 | |
| 112 | return pools; |
| 113 | } |
| 114 | |
| 115 | |
| 116 | void SaveSummaryToFile(const TFeaturesSelectionSummary& summary, const TString& resultPath) { |
no test coverage detected