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

Function test_generated_metrics

catboost/python-package/ut/medium/test.py:3008–3031  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3006
3007
3008def test_generated_metrics():
3009 # Test equivalence of the generated metric classes to string representations.
3010 train_pool = Pool(data=TRAIN_FILE, column_description=CD_FILE)
3011 test_pool = Pool(data=TEST_FILE, column_description=CD_FILE)
3012
3013 model = CatBoostRegressor()
3014 model.fit(train_pool)
3015 eval_metrics = [metrics.Lq(q=3)]
3016 metrics_evals = model.eval_metrics(test_pool, eval_metrics)
3017 for metric in eval_metrics:
3018 assert str(metric) in metrics_evals
3019
3020 # Test setting hints and default values.
3021 results = cv(
3022 train_pool,
3023 {
3024 'iterations': 20,
3025 'learning_rate': 0.03,
3026 'loss_function': metrics.Logloss().set_hints(skip_train=True),
3027 'eval_metric': metrics.AUC()
3028 },
3029 )
3030 for non_existing_field in ('train-Logloss-mean', 'train-Logloss-std', 'train-AUC-mean', 'train-AUC-std'):
3031 assert non_existing_field not in results
3032
3033
3034def test_metrics_is_min_max_optimal():

Callers

nothing calls this directly

Calls 7

fitMethod · 0.95
PoolClass · 0.90
CatBoostRegressorClass · 0.90
cvFunction · 0.90
eval_metricsMethod · 0.80
strClass · 0.50
set_hintsMethod · 0.45

Tested by

no test coverage detected