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

Function _agg_cv_result

python-package/lightgbmmt/engine.py:356–369  ·  view source on GitHub ↗

Aggregate cross-validation results.

(raw_results, eval_train_metric=False)

Source from the content-addressed store, hash-verified

354
355
356def _agg_cv_result(raw_results, eval_train_metric=False):
357 """Aggregate cross-validation results."""
358 cvmap = collections.OrderedDict()
359 metric_type = {}
360 for one_result in raw_results:
361 for one_line in one_result:
362 if eval_train_metric:
363 key = "{} {}".format(one_line[0], one_line[1])
364 else:
365 key = one_line[1]
366 metric_type[key] = one_line[3]
367 cvmap.setdefault(key, [])
368 cvmap[key].append(one_line[2])
369 return [('cv_agg', k, np.mean(v), metric_type[k], np.std(v)) for k, v in cvmap.items()]
370
371
372def cv(params, train_set, num_boost_round=100,

Callers 1

cvFunction · 0.85

Calls 2

formatMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected