MCPcopy Create free account
hub / github.com/catboost/catboost / MapBuildPlainFold

Function MapBuildPlainFold

catboost/private/libs/distributed/master.cpp:180–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void MapBuildPlainFold(TLearnContext* ctx) {
181 Y_ASSERT(ctx->Params.SystemOptions->IsMaster());
182
183 NJson::TJsonValue jsonParams;
184 ctx->Params.Save(&jsonParams);
185 const auto& metricOptions = ctx->Params.MetricOptions;
186 if (metricOptions->EvalMetric.NotSet()) { // workaround for NotSet + Save + Load = DefaultValue
187 if (ctx->Params.LossFunctionDescription->GetLossFunction() !=
188 metricOptions->EvalMetric->GetLossFunction()) {
189 // skip only if default metric differs from loss function
190
191 const auto& evalMetric = metricOptions->EvalMetric;
192 jsonParams[metricOptions.GetName()][evalMetric.GetName()][evalMetric->LossParams.GetName()]
193 .InsertValue("hints", "skip_train~true");
194 }
195 }
196 if (ctx->Params.DataProcessingOptions->AutoClassWeights.Get() != EAutoClassWeightsType::None) {
197 // avoid issues with validation after deserialization on workers
198 jsonParams["data_processing_options"].EraseValue("auto_class_weights");
199 }
200
201 const auto& plainFold = ctx->LearnProgress->Folds[0];
202 Y_ASSERT(plainFold.PermutationBlockSize == plainFold.GetLearnSampleCount() ||
203 plainFold.PermutationBlockSize == 1);
204 const int workerCount = TMasterEnvironment::GetRef().RootEnvironment->GetSlaveCount();
205 ApplyMapper<TPlainFoldBuilder>(
206 workerCount,
207 TMasterEnvironment::GetRef().SharedTrainData,
208 TPlainFoldBuilderParams({
209 ctx->CtrsHelper.GetTargetClassifiers(),
210 ctx->LearnProgress->Rand.GenRand(),
211 ctx->LearnProgress->ApproxDimension,
212 WriteTJsonValue(jsonParams),
213 plainFold.GetLearnSampleCount(),
214 plainFold.GetSumWeight(),
215 ctx->LearnProgress->HessianType
216 })
217 );
218}
219
220void MapRestoreApproxFromTreeStruct(TMaybe<int> bestIteration, TLearnContext* ctx) {
221 Y_ASSERT(ctx->Params.SystemOptions->IsMaster());

Callers 1

TrainModelMethod · 0.85

Calls 13

WriteTJsonValueFunction · 0.85
NotSetMethod · 0.80
GetLearnSampleCountMethod · 0.80
GetSumWeightMethod · 0.80
IsMasterMethod · 0.45
SaveMethod · 0.45
GetLossFunctionMethod · 0.45
GetNameMethod · 0.45
GetMethod · 0.45
EraseValueMethod · 0.45
GetSlaveCountMethod · 0.45

Tested by

no test coverage detected