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

Function GetFeature

catboost/libs/fstr/feature_str.cpp:298–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298TFeature GetFeature(const TFullModel& model, const TModelSplit& split) {
299 TFeature result;
300 result.Type = split.Type;
301 switch(result.Type) {
302 case ESplitType::FloatFeature:
303 result.FeatureIdx = split.FloatFeature.FloatFeature;
304 break;
305 case ESplitType::OneHotFeature:
306 result.FeatureIdx = split.OneHotFeature.CatFeatureIdx;
307 break;
308 case ESplitType::OnlineCtr:
309 result.Ctr = split.OnlineCtr.Ctr;
310 break;
311 case ESplitType::EstimatedFeature:
312 result.EstimatedFeature = TModelEstimatedFeature{
313 split.EstimatedFeature.ModelEstimatedFeature.SourceFeatureId,
314 split.EstimatedFeature.ModelEstimatedFeature.CalcerId,
315 split.EstimatedFeature.ModelEstimatedFeature.LocalId,
316 split.EstimatedFeature.ModelEstimatedFeature.SourceFeatureType
317 };
318 result.FeatureCalcerType = GetEstimatedFeatureCalcerType(
319 model,
320 split.EstimatedFeature.ModelEstimatedFeature
321 );
322 result.FeatureIdx = split.EstimatedFeature.ModelEstimatedFeature.SourceFeatureId;
323 break;
324 default:
325 CB_ENSURE(false, "Unsupported split type " << result.Type);
326 }
327 return result;
328}

Callers 7

PrintFeatureSetMethod · 0.85
AddFeatureMethod · 0.85
ValidateFeatureSetMethod · 0.85
BuildTreesFunction · 0.85
GetFeatureToIdxMapFunction · 0.85
DFSFunction · 0.85

Calls 1

Tested by

no test coverage detected