| 93 | |
| 94 | |
| 95 | static TDataProviders LoadPools( |
| 96 | const NCatboostOptions::TPoolLoadParams& loadOptions, |
| 97 | ETaskType taskType, |
| 98 | ui64 cpuRamLimit, |
| 99 | EObjectsOrder objectsOrder, |
| 100 | TDatasetSubset trainDatasetSubset, |
| 101 | TConstArrayRef<TDatasetSubset> testDatasetSubsets, |
| 102 | bool forceUnitAutoPairWeights, |
| 103 | TVector<NJson::TJsonValue>* classLabels, |
| 104 | NPar::ILocalExecutor* const executor, |
| 105 | TProfileInfo* profile |
| 106 | ) { |
| 107 | const auto& cvParams = loadOptions.CvParams; |
| 108 | const bool cvMode = cvParams.FoldCount != 0; |
| 109 | CB_ENSURE( |
| 110 | !cvMode || loadOptions.TestSetPaths.empty(), |
| 111 | "Test files are not supported in cross-validation mode" |
| 112 | ); |
| 113 | |
| 114 | auto pools = NCB::ReadTrainDatasets( |
| 115 | taskType, |
| 116 | loadOptions, |
| 117 | objectsOrder, |
| 118 | !cvMode, |
| 119 | trainDatasetSubset, |
| 120 | testDatasetSubsets, |
| 121 | forceUnitAutoPairWeights, |
| 122 | classLabels, |
| 123 | executor, |
| 124 | profile); |
| 125 | |
| 126 | if (cvMode) { |
| 127 | if (cvParams.Shuffle && (pools.Learn->ObjectsData->GetOrder() != EObjectsOrder::RandomShuffled)) { |
| 128 | TRestorableFastRng64 rand(cvParams.PartitionRandSeed); |
| 129 | |
| 130 | auto objectsGroupingSubset = NCB::Shuffle(pools.Learn->ObjectsGrouping, 1, &rand); |
| 131 | pools.Learn = pools.Learn->GetSubset(objectsGroupingSubset, cpuRamLimit, executor); |
| 132 | } |
| 133 | |
| 134 | TVector<TDataProviders> foldPools = PrepareCvFolds<TDataProviders>( |
| 135 | std::move(pools.Learn), |
| 136 | cvParams, |
| 137 | cvParams.FoldIdx, |
| 138 | /* oldCvStyleSplit */ true, |
| 139 | cpuRamLimit, |
| 140 | executor); |
| 141 | CB_ENSURE(foldPools.size() == 1, "In cross-validation mode, only one fold is supported"); |
| 142 | |
| 143 | profile->AddOperation("Build cv pools"); |
| 144 | |
| 145 | return foldPools[0]; |
| 146 | } else { |
| 147 | return pools; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | static bool HasInvalidValues(const TVector<TVector<double>>& treeLeafValues) { |
| 152 | for (const auto& leafValuesDimension : treeLeafValues) { |
no test coverage detected