| 1419 | } |
| 1420 | |
| 1421 | static void ModelBasedEval( |
| 1422 | const NJson::TJsonValue& trainOptionsJson, |
| 1423 | const NCatboostOptions::TOutputFilesOptions& outputOptions, |
| 1424 | TQuantizedFeaturesInfoPtr quantizedFeaturesInfo, |
| 1425 | TDataProviders pools, |
| 1426 | NPar::ILocalExecutor* const executor) |
| 1427 | { |
| 1428 | CB_ENSURE(pools.Learn != nullptr, "Train data must be provided"); |
| 1429 | |
| 1430 | const ETaskType taskType = NCatboostOptions::GetTaskType(trainOptionsJson); |
| 1431 | |
| 1432 | CB_ENSURE(taskType == ETaskType::GPU, "Model based eval is not implemented for CPU"); |
| 1433 | |
| 1434 | CB_ENSURE(pools.Test.size() <= 1, "Multiple eval sets not supported for GPU"); |
| 1435 | |
| 1436 | NJson::TJsonValue updatedTrainOptionsJson = trainOptionsJson; |
| 1437 | |
| 1438 | CB_ENSURE(TTrainerFactory::Has(ETaskType::GPU), |
| 1439 | "Can't load GPU learning library. Module was not compiled or driver is incompatible with package. Please install latest NVDIA driver and check again."); |
| 1440 | |
| 1441 | THolder<IModelTrainer> modelTrainerHolder(TTrainerFactory::Construct(ETaskType::GPU)); |
| 1442 | if (outputOptions.SaveSnapshot()) { |
| 1443 | UpdateUndefinedRandomSeed(ETaskType::GPU, outputOptions, &updatedTrainOptionsJson, [&](IInputStream* in, TString& params) { |
| 1444 | ::Load(in, params); |
| 1445 | }); |
| 1446 | } |
| 1447 | |
| 1448 | const auto learnFeaturesLayout = pools.Learn->MetaInfo.FeaturesLayout; |
| 1449 | NCatboostOptions::TCatBoostOptions catBoostOptions(taskType); |
| 1450 | catBoostOptions.Load(updatedTrainOptionsJson); |
| 1451 | |
| 1452 | ValidateFeaturesToEvaluate(trainOptionsJson, pools.Learn->MetaInfo.GetFeatureCount()); |
| 1453 | |
| 1454 | if (!quantizedFeaturesInfo) { |
| 1455 | quantizedFeaturesInfo = MakeIntrusive<TQuantizedFeaturesInfo>( |
| 1456 | *learnFeaturesLayout, |
| 1457 | catBoostOptions.DataProcessingOptions.Get().IgnoredFeatures.Get(), |
| 1458 | catBoostOptions.DataProcessingOptions->FloatFeaturesBinarization.Get(), |
| 1459 | catBoostOptions.DataProcessingOptions->PerFloatFeatureQuantization.Get(), |
| 1460 | catBoostOptions.DataProcessingOptions->TextProcessingOptions.Get(), |
| 1461 | catBoostOptions.DataProcessingOptions->EmbeddingProcessingOptions.Get(), |
| 1462 | /*allowNansInTestOnly*/true |
| 1463 | ); |
| 1464 | } |
| 1465 | |
| 1466 | for (auto testPoolIdx : xrange(pools.Test.size())) { |
| 1467 | const auto& testPool = *pools.Test[testPoolIdx]; |
| 1468 | if (testPool.GetObjectCount() == 0) { |
| 1469 | continue; |
| 1470 | } |
| 1471 | CheckCompatibleForApply( |
| 1472 | *learnFeaturesLayout, |
| 1473 | *testPool.MetaInfo.FeaturesLayout, |
| 1474 | TStringBuilder() << "test dataset #" << testPoolIdx); |
| 1475 | } |
| 1476 | |
| 1477 | TSetLogging inThisScope(catBoostOptions.LoggingLevel); |
| 1478 |
no test coverage detected