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

Function GetFeatureIndices

catboost/libs/model_interface/c_api.cpp:200–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198 }
199
200 bool GetFeatureIndices(std::function<TVector<size_t>()> getFeatureIndices, size_t** indices, size_t* count) {
201 try {
202 auto featureIndices = getFeatureIndices();
203 *count = featureIndices.size();
204 if (!featureIndices.size()) {
205 *indices = nullptr;
206 } else {
207 *indices = (size_t*)malloc(sizeof(size_t) * featureIndices.size());
208 if (!*indices) {
209 throw std::bad_alloc();
210 }
211
212 std::copy(featureIndices.begin(), featureIndices.end(), *indices);
213 }
214 } catch(...) {
215 ErrorMessageHolder.Get().Message = CurrentExceptionMessage();
216 return false;
217 }
218 return true;
219 }
220
221} // namespace
222

Callers 4

GetCatFeatureIndicesFunction · 0.85
GetFloatFeatureIndicesFunction · 0.85
GetTextFeatureIndicesFunction · 0.85

Calls 8

CurrentExceptionMessageFunction · 0.85
mallocFunction · 0.50
bad_allocClass · 0.50
copyFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected