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

Method EstimateIdsLength

catboost/private/libs/quantized_pool/serialization.cpp:775–804  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

773}
774
775size_t NCB::EstimateIdsLength(const TStringBuf path) {
776 const auto file = TBlob::FromFile(TString(path));
777 const TConstArrayRef<ui8> blob(file.AsUnsignedCharPtr(), file.Size());
778
779 TPoolMetainfo poolMetainfo;
780 auto parseMetainfo = [&] (TConstArrayRef<ui8> bytes) {
781 const auto poolMetainfoParsed = poolMetainfo.ParseFromArray(bytes.data(), bytes.size());
782 CB_ENSURE(poolMetainfoParsed);
783 };
784 TVector<TVector<NCB::TQuantizedPool::TChunkDescription>> stringColumnChunks;
785 bool isFakeColumn = false;
786 auto parseColumn = [&] (ui32 columnIndex) -> bool {
787 isFakeColumn = NCB::NQuantizationSchemaDetail::IsFakeIndex(columnIndex, poolMetainfo);
788 return true;
789 };
790 size_t estimatedIdsLength = 0;
791 auto parseChunk = [&] (TConstArrayRef<ui8> bytes, ui32 docOffset, ui32 docsInChunkCount) {
792 const auto* const chunk = flatbuffers::GetRoot<NCB::NIdl::TQuantizedFeatureChunk>(bytes.data());
793 if (isFakeColumn && docOffset == 0) {
794 estimatedIdsLength += 1 + chunk->Quants()->size() / (docsInChunkCount + 1);
795 }
796 };
797 ParseQuantizedPool(
798 parseMetainfo,
799 /*parseSchema*/ Nothing(),
800 parseColumn,
801 parseChunk,
802 blob);
803 return estimatedIdsLength;
804}
805
806void NCB::EstimateGroupSize(
807 const TStringBuf path,

Callers

nothing calls this directly

Calls 8

IsFakeIndexFunction · 0.85
ParseQuantizedPoolFunction · 0.85
NothingFunction · 0.85
AsUnsignedCharPtrMethod · 0.80
SizeMethod · 0.45
ParseFromArrayMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected