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

Function GetPositionBy

catboost/libs/carry_model/carry.cpp:25–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24 template <typename Cmp, typename V>
25 TVector<TFeaturePosition> GetPositionBy(const TFullModel& model, const TVector<V>& factors) {
26 TVector<TFeaturePosition> factorIds;
27 const auto& floatFeatures = model.ModelTrees->GetFloatFeatures();
28 for (const auto& factor : factors) {
29 const auto it = std::find_if(
30 floatFeatures.begin(),
31 floatFeatures.end(),
32 [&factor](const auto& node) { return Cmp()(node, factor); });
33
34 CB_ENSURE(it != floatFeatures.end(), "feature not found");
35 factorIds.emplace_back(it->Position);
36 }
37 return factorIds;
38 }
39
40 ui64 RemoveMask(ui64 path, ui64 mask) {
41 // reduce path in oblivious tree by mask

Callers

nothing calls this directly

Calls 5

CmpFunction · 0.85
GetFloatFeaturesMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected