| 178 | } |
| 179 | |
| 180 | void 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 | |
| 220 | void MapRestoreApproxFromTreeStruct(TMaybe<int> bestIteration, TLearnContext* ctx) { |
| 221 | Y_ASSERT(ctx->Params.SystemOptions->IsMaster()); |
no test coverage detected