| 831 | } |
| 832 | |
| 833 | static void EvaluateFeaturesImpl( |
| 834 | const NCatboostOptions::TCatBoostOptions& catBoostOptions, |
| 835 | const NCatboostOptions::TOutputFilesOptions& outputFileOptions, |
| 836 | const NCatboostOptions::TFeatureEvalOptions& featureEvalOptions, |
| 837 | const TMaybe<TCustomObjectiveDescriptor>& objectiveDescriptor, |
| 838 | const TMaybe<TCustomMetricDescriptor>& evalMetricDescriptor, |
| 839 | ui32 foldRangeBegin, |
| 840 | const TCvDataPartitionParams& cvParams, |
| 841 | TDataProviderPtr data, |
| 842 | ui32 processedFoldCount, |
| 843 | TFeatureEvaluationCallbacks* callbacks, |
| 844 | TFeatureEvaluationSummary* results |
| 845 | ) { |
| 846 | const ui32 foldCount = cvParams.Initialized() ? cvParams.FoldCount : featureEvalOptions.FoldCount.Get(); |
| 847 | CB_ENSURE(data->ObjectsData->GetObjectCount() > foldCount, "Pool is too small to be split into folds"); |
| 848 | CB_ENSURE(data->ObjectsData->GetObjectCount() > featureEvalOptions.FoldSize.Get(), "Pool is too small to be split into folds"); |
| 849 | |
| 850 | const ui64 cpuUsedRamLimit |
| 851 | = ParseMemorySizeDescription(catBoostOptions.SystemOptions->CpuUsedRamLimit.Get()); |
| 852 | |
| 853 | TRestorableFastRng64 rand(catBoostOptions.RandomSeed); |
| 854 | |
| 855 | if (cvParams.Shuffle) { |
| 856 | auto objectsGroupingSubset = NCB::Shuffle(data->ObjectsGrouping, 1, &rand); |
| 857 | data = data->GetSubset(objectsGroupingSubset, cpuUsedRamLimit, &NPar::LocalExecutor()); |
| 858 | } |
| 859 | |
| 860 | TLabelConverter labelConverter; |
| 861 | TMaybe<float> targetBorder = catBoostOptions.DataProcessingOptions->TargetBorder; |
| 862 | NCatboostOptions::TCatBoostOptions dataSpecificOptions(catBoostOptions); |
| 863 | |
| 864 | TString tmpDir; |
| 865 | if (outputFileOptions.AllowWriteFiles()) { |
| 866 | NCB::NPrivate::CreateTrainDirWithTmpDirIfNotExist(outputFileOptions.GetTrainDir(), &tmpDir); |
| 867 | } |
| 868 | |
| 869 | TTrainingDataProviderPtr trainingData = GetTrainingData( |
| 870 | std::move(data), |
| 871 | /*dataCanBeEmpty*/ false, |
| 872 | /*isLearnData*/ true, |
| 873 | TStringBuf(), |
| 874 | Nothing(), // TODO(akhropov): allow loading borders and nanModes in CV? |
| 875 | /*unloadCatFeaturePerfectHashFromRam*/ outputFileOptions.AllowWriteFiles(), |
| 876 | /*ensureConsecutiveLearnFeaturesDataForCpu*/ false, |
| 877 | tmpDir, |
| 878 | /*quantizedFeaturesInfo*/ nullptr, |
| 879 | &dataSpecificOptions, |
| 880 | &labelConverter, |
| 881 | &targetBorder, |
| 882 | &NPar::LocalExecutor(), |
| 883 | &rand); |
| 884 | |
| 885 | CB_ENSURE( |
| 886 | dynamic_cast<TQuantizedObjectsDataProvider*>(trainingData->ObjectsData.Get()), |
| 887 | "Unable to quantize dataset (probably because it contains categorical features)" |
| 888 | ); |
| 889 | |
| 890 | UpdateYetiRankEvalMetric(trainingData->MetaInfo.TargetStats, Nothing(), &dataSpecificOptions); |
no test coverage detected