| 72 | |
| 73 | |
| 74 | TVector<TVector<double>> EvalMetrics( |
| 75 | const TFullModel& model, |
| 76 | const NCB::TDataProvider& srcData, |
| 77 | const TVector<TString>& metricsDescription, |
| 78 | int begin, |
| 79 | int end, |
| 80 | int evalPeriod, |
| 81 | int threadCount, |
| 82 | const TString& resultDir, |
| 83 | const TString& tmpDir |
| 84 | ) { |
| 85 | NPar::TLocalExecutor executor; |
| 86 | executor.RunAdditionalThreads(threadCount - 1); |
| 87 | |
| 88 | TRestorableFastRng64 rand(0); |
| 89 | |
| 90 | auto metricLossDescriptions = CreateMetricLossDescriptions(metricsDescription); |
| 91 | auto metrics = CreateMetrics(metricLossDescriptions, model.GetDimensionsCount()); |
| 92 | TMetricsPlotCalcer plotCalcer = CreateMetricCalcer( |
| 93 | model, |
| 94 | begin, |
| 95 | end, |
| 96 | evalPeriod, |
| 97 | /*processedIterationsStep=*/50, |
| 98 | tmpDir, |
| 99 | metrics, |
| 100 | &executor |
| 101 | ); |
| 102 | |
| 103 | auto processedDataProvider = NCB::CreateModelCompatibleProcessedDataProvider( |
| 104 | srcData, |
| 105 | metricLossDescriptions, |
| 106 | model, |
| 107 | NCB::GetMonopolisticFreeCpuRam(), |
| 108 | &rand, |
| 109 | &executor |
| 110 | ); |
| 111 | |
| 112 | if (plotCalcer.HasAdditiveMetric()) { |
| 113 | plotCalcer.ProceedDataSetForAdditiveMetrics(processedDataProvider); |
| 114 | } |
| 115 | if (plotCalcer.HasNonAdditiveMetric()) { |
| 116 | while (!plotCalcer.AreAllIterationsProcessed()) { |
| 117 | plotCalcer.ProceedDataSetForNonAdditiveMetrics(processedDataProvider); |
| 118 | plotCalcer.FinishProceedDataSetForNonAdditiveMetrics(); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | TVector<TVector<double>> metricsScore = plotCalcer.GetMetricsScore(); |
| 123 | |
| 124 | plotCalcer.SaveResult(resultDir, /*metricsFile=*/"", /*saveMetrics*/ false, /*saveStats=*/true).ClearTempFiles(); |
| 125 | return metricsScore; |
| 126 | } |
| 127 | |
| 128 | TVector<TString> GetMetricNames(const TFullModel& model, const TVector<TString>& metricsDescription) { |
| 129 | auto metrics = CreateMetricsFromDescription(metricsDescription, model.GetDimensionsCount()); |
nothing calls this directly
no test coverage detected