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

Function QuantizeBlock

catboost/private/libs/quantization/utils.h:89–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 // TODO(kirillovs): replace with effective block-quantizer from model evaluation code
88 template <typename TQuantizedBin>
89 void QuantizeBlock(TConstArrayRef<float> srcFeatureData,
90 bool allowNans,
91 ENanMode nanMode,
92 ui32 featureIdx, // for error message
93
94 // if nanMode != ENanMode::Forbidden borders must include -min_float or +max_float
95 TConstArrayRef<float> borders,
96 TArrayRef<TQuantizedBin> quantizedData) {
97 Y_ASSERT(srcFeatureData.size() == quantizedData.size());
98 for (size_t i : xrange(srcFeatureData.size())) {
99 quantizedData[i] = Quantize<TQuantizedBin>(featureIdx,
100 allowNans,
101 nanMode,
102 borders,
103 srcFeatureData[i]);
104 }
105 }
106
107 template <typename TQuantizedBin>
108 void Quantize(const ITypedArraySubset<float>& srcFeatureData,

Callers 1

GetBlockIteratorMethod · 0.85

Calls 2

xrangeFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected