MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / SetInitScore

Method SetInitScore

src/io/metadata.cpp:282–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282void Metadata::SetInitScore(const double* init_score, data_size_t len) {
283 std::lock_guard<std::mutex> lock(mutex_);
284 // save to nullptr
285 if (init_score == nullptr || len == 0) {
286 init_score_.clear();
287 num_init_score_ = 0;
288 return;
289 }
290 if ((len % num_data_) != 0) {
291 Log::Fatal("Initial score size doesn't match data size");
292 }
293 if (!init_score_.empty()) { init_score_.clear(); }
294 num_init_score_ = len;
295 init_score_ = std::vector<double>(len);
296 #pragma omp parallel for schedule(static)
297 for (int64_t i = 0; i < num_init_score_; ++i) {
298 init_score_[i] = Common::AvoidInf(init_score[i]);
299 }
300 init_score_load_from_file_ = false;
301}
302
303void Metadata::SetLabel(const label_t* label, data_size_t len) {
304 std::lock_guard<std::mutex> lock(mutex_);

Callers 3

SetDoubleFieldMethod · 0.45

Calls 3

AvoidInfFunction · 0.50
clearMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected