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

Function LoadFeatures

catboost/libs/data/objects.cpp:1078–1182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1076
1077template <EFeatureType FeatureType, class TColumn>
1078static void LoadFeatures(
1079 const TFeaturesLayout& featuresLayout,
1080 const TFeaturesArraySubsetIndexing* subsetIndexing,
1081 const TMaybe<TPackedBinaryFeaturesData*> packedBinaryFeaturesData,
1082 const TMaybe<TExclusiveFeatureBundlesData*> exclusiveFeatureBundlesData,
1083 const TMaybe<TFeatureGroupsData*> featureGroupsData,
1084 IBinSaver* binSaver,
1085 TVector<THolder<TColumn>>* dst
1086) {
1087 TVector<TMaybe<TPackedBinaryIndex>>* featureToPackedBinaryIndex;
1088 if (packedBinaryFeaturesData) {
1089 featureToPackedBinaryIndex = &(**packedBinaryFeaturesData).FlatFeatureIndexToPackedBinaryIndex;
1090 } else {
1091 featureToPackedBinaryIndex = nullptr;
1092 }
1093
1094 TVector<TMaybe<TExclusiveBundleIndex>>* featureToBundlePart;
1095 if (exclusiveFeatureBundlesData) {
1096 featureToBundlePart = &(**exclusiveFeatureBundlesData).FlatFeatureIndexToBundlePart;
1097 } else {
1098 featureToBundlePart = nullptr;
1099 }
1100
1101 TVector<TMaybe<TFeaturesGroupIndex>>* featureToGroupPart;
1102 if (featureGroupsData) {
1103 featureToGroupPart = &(**featureGroupsData).FlatFeatureIndexToGroupPart;
1104 } else {
1105 featureToGroupPart = nullptr;
1106 }
1107
1108 dst->clear();
1109 dst->resize(featuresLayout.GetFeatureCount(FeatureType));
1110
1111 featuresLayout.IterateOverAvailableFeatures<FeatureType>(
1112 [&] (TFeatureIdx<FeatureType> featureIdx) {
1113 ui32 flatFeatureIdx = featuresLayout.GetExternalFeatureIdx(*featureIdx, FeatureType);
1114
1115 ui32 id;
1116 ESavedColumnType savedColumnType;
1117 LoadMulti(binSaver, &id, (ui8*)&savedColumnType);
1118
1119 CB_ENSURE_INTERNAL(
1120 flatFeatureIdx == id,
1121 "deserialized feature id (" << id << ") is not equal to expected flatFeatureIdx ("
1122 << flatFeatureIdx << ")"
1123 );
1124
1125
1126 if (featureToPackedBinaryIndex && (*featureToPackedBinaryIndex)[flatFeatureIdx]) {
1127 TPackedBinaryIndex packedBinaryIndex = *((*featureToPackedBinaryIndex)[flatFeatureIdx]);
1128
1129 ui8 bitIdx = 0;
1130 binSaver->Add(0, &bitIdx);
1131
1132 CB_ENSURE_INTERNAL(
1133 packedBinaryIndex.BitIdx == bitIdx,
1134 "deserialized bitIdx (" << bitIdx << ") is not equal to expected packedBinaryIndex.BitIdx ("
1135 << packedBinaryIndex.BitIdx << ")"

Callers

nothing calls this directly

Calls 8

LoadMultiFunction · 0.85
LoadNonBundledColumnDataFunction · 0.85
GetExternalFeatureIdxMethod · 0.80
clearMethod · 0.45
resizeMethod · 0.45
GetFeatureCountMethod · 0.45
AddMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected