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

Function test_fit_data

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

Source from the content-addressed store, hash-verified

2374
2375
2376def test_fit_data(task_type):
2377 pool = Pool(CLOUDNESS_TRAIN_FILE, column_description=CLOUDNESS_CD_FILE)
2378 eval_pool = Pool(CLOUDNESS_TEST_FILE, column_description=CLOUDNESS_CD_FILE)
2379 base_model = CatBoostClassifier(iterations=10, learning_rate=0.05, loss_function="MultiClass", task_type=task_type, gpu_ram_part=TEST_GPU_RAM_PART, devices='0')
2380 base_model.fit(pool)
2381 baseline = np.array(base_model.predict(pool, prediction_type='RawFormulaVal'))
2382 eval_baseline = np.array(base_model.predict(eval_pool, prediction_type='RawFormulaVal'))
2383 eval_pool.set_baseline(eval_baseline)
2384 model = CatBoostClassifier(iterations=90, learning_rate=0.05, loss_function="MultiClass")
2385 data = get_features_data_from_file(
2386 CLOUDNESS_TRAIN_FILE,
2387 drop_columns=[0],
2388 cat_feature_indices=pool.get_cat_feature_indices()
2389 )
2390 model.fit(data, pool.get_label(), sample_weight=np.arange(1, pool.num_row() + 1), baseline=baseline, use_best_model=True, eval_set=eval_pool)
2391 pred = model.predict_proba(eval_pool)
2392 preds_path = test_output_path(PREDS_PATH)
2393 np.save(preds_path, np.array(pred))
2394 return local_canonical_file(preds_path, diff_tool=get_limited_precision_numpy_diff_tool())
2395
2396
2397def test_fit_predict_baseline(task_type):

Callers

nothing calls this directly

Calls 14

fitMethod · 0.95
predictMethod · 0.95
set_baselineMethod · 0.95
predict_probaMethod · 0.95
PoolClass · 0.90
CatBoostClassifierClass · 0.90
test_output_pathFunction · 0.85
get_labelMethod · 0.80
local_canonical_fileFunction · 0.50

Tested by

no test coverage detected