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

Function AddFeatureToBundle

catboost/libs/data/exclusive_feature_bundling.cpp:49–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48
49 static void AddFeatureToBundle(
50 const TQuantizedFeaturesInfo& quantizedFeaturesInfo,
51 ui32 flatFeatureIdx,
52 TConstArrayRef<std::pair<ui32, ui64>> featureNonDefaultMasks,
53 ui32 featureNonDefaultCount,
54 ui32 binCountInBundleNeeded,
55 ui32 intersectionCount,
56 TExclusiveFeaturesBundle* bundle,
57 TExclusiveFeatureBundleForMerging* bundleForMerging
58 ) {
59 const auto& featuresLayout = *quantizedFeaturesInfo.GetFeaturesLayout();
60 const auto featureMetaInfo = featuresLayout.GetExternalFeaturesMetaInfo()[flatFeatureIdx];
61
62 TExclusiveBundlePart part;
63 part.FeatureType = featureMetaInfo.Type;
64 part.FeatureIdx = featuresLayout.GetInternalFeatureIdx(flatFeatureIdx);
65 auto usedBinCount = bundle->GetUsedByPartsBinCount();
66
67 part.Bounds = TBoundsInBundle(usedBinCount, usedBinCount + binCountInBundleNeeded);
68 bundle->Add(std::move(part));
69
70 bundleForMerging->NonDefaultCount += featureNonDefaultCount;
71 bundleForMerging->IntersectionCount += intersectionCount;
72
73 TArrayRef<ui64> bundleMasks = bundleForMerging->UsedObjects;
74
75 for (auto [blockIdx, mask] : featureNonDefaultMasks) {
76 bundleMasks[blockIdx] = bundleMasks[blockIdx] | mask;
77 }
78 }
79
80 static ui32 CalcIntersectionCount(
81 TConstArrayRef<ui64> usedObjectsInBundle,

Callers 1

Calls 6

moveFunction · 0.50
GetFeaturesLayoutMethod · 0.45
GetInternalFeatureIdxMethod · 0.45
AddMethod · 0.45

Tested by

no test coverage detected