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

Method ResetConfig

python-package/compile/src/c_api.cpp:175–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173 }
174
175 void ResetConfig(const char* parameters) {
176 std::lock_guard<std::mutex> lock(mutex_);
177 auto param = Config::Str2Map(parameters);
178 if (param.count("num_class")) {
179 Log::Fatal("Cannot change num_class during training");
180 }
181 if (param.count("boosting")) {
182 Log::Fatal("Cannot change boosting during training");
183 }
184 if (param.count("metric")) {
185 Log::Fatal("Cannot change metric during training");
186 }
187
188 config_.Set(param);
189 if (config_.num_threads > 0) {
190 omp_set_num_threads(config_.num_threads);
191 }
192
193 if (param.count("objective")) {
194 // create objective function
195 objective_fun_.reset(ObjectiveFunction::CreateObjectiveFunction(config_.objective,
196 config_));
197 if (objective_fun_ == nullptr) {
198 Log::Warning("Using self-defined objective function");
199 }
200 // initialize the objective function
201 if (objective_fun_ != nullptr) {
202 objective_fun_->Init(train_data_->metadata(), train_data_->num_data());
203 }
204 boosting_->ResetTrainingData(train_data_,
205 objective_fun_.get(), Common::ConstPtrInVectorWrapper<Metric>(train_metric_));
206 }
207
208 boosting_->ResetConfig(&config_);
209 }
210
211 void AddValidData(const Dataset* valid_data) {
212 std::lock_guard<std::mutex> lock(mutex_);

Callers 2

LGBM_DatasetUpdateParamFunction · 0.45

Calls 8

resetMethod · 0.80
omp_set_num_threadsFunction · 0.50
countMethod · 0.45
SetMethod · 0.45
InitMethod · 0.45
num_dataMethod · 0.45
ResetTrainingDataMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected