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

Function test_multilabel

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

Source from the content-addressed store, hash-verified

2078
2079@pytest.mark.parametrize('prediction_type', ['RawFormulaVal', 'Probability', 'Class'])
2080def test_multilabel(prediction_type):
2081 pool = Pool(SCENE_TRAIN_FILE, column_description=SCENE_CD_FILE)
2082 classifier = CatBoostClassifier(iterations=2, loss_function='MultiLogloss', thread_count=8)
2083 classifier.fit(pool)
2084 output_model_path = test_output_path(OUTPUT_MODEL_PATH)
2085 classifier.save_model(output_model_path)
2086 new_classifier = CatBoostClassifier()
2087 new_classifier.load_model(output_model_path)
2088 pred = new_classifier.predict(pool, prediction_type=prediction_type)
2089 preds_path = test_output_path(PREDS_PATH)
2090 if prediction_type == 'Class':
2091 np.savetxt(preds_path, np.array(pred), fmt='%.0f')
2092 else:
2093 np.savetxt(preds_path, np.array(pred), fmt='%.8f')
2094 return local_canonical_file(preds_path)
2095
2096
2097@pytest.mark.parametrize('target_count', [1, 2, 3])

Callers

nothing calls this directly

Calls 9

fitMethod · 0.95
predictMethod · 0.95
PoolClass · 0.90
CatBoostClassifierClass · 0.90
test_output_pathFunction · 0.85
save_modelMethod · 0.80
load_modelMethod · 0.80
local_canonical_fileFunction · 0.50
arrayMethod · 0.45

Tested by

no test coverage detected