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

Method CreateObjectiveAndMetrics

src/c_api.cpp:140–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138 }
139
140 void CreateObjectiveAndMetrics() {
141 // create objective function
142 objective_fun_.reset(ObjectiveFunction::CreateObjectiveFunction(config_.objective,
143 config_));
144 if (objective_fun_ == nullptr) {
145 Log::Warning("Using self-defined objective function");
146 }
147 // initialize the objective function
148 if (objective_fun_ != nullptr) {
149 objective_fun_->Init(train_data_->metadata(), train_data_->num_data());
150 }
151
152 // create training metric
153 train_metric_.clear();
154 for (auto metric_type : config_.metric) {
155 auto metric = std::unique_ptr<Metric>(
156 Metric::CreateMetric(metric_type, config_));
157 if (metric == nullptr) { continue; }
158 metric->Init(train_data_->metadata(), train_data_->num_data());
159 train_metric_.push_back(std::move(metric));
160 }
161 train_metric_.shrink_to_fit();
162 }
163
164 void ResetTrainingData(const Dataset* train_data) {
165 if (train_data != train_data_) {

Callers

nothing calls this directly

Calls 6

resetMethod · 0.80
push_backMethod · 0.80
InitMethod · 0.45
num_dataMethod · 0.45
clearMethod · 0.45
shrink_to_fitMethod · 0.45

Tested by

no test coverage detected