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

Function test_querywise

catboost/python-package/ut/medium/test.py:2238–2255  ·  view source on GitHub ↗
(features_dtype, task_type)

Source from the content-addressed store, hash-verified

2236 ids=['features_dtype=str', 'features_dtype=np.float32']
2237)
2238def test_querywise(features_dtype, task_type):
2239 train_pool = Pool(QUERYWISE_TRAIN_FILE, column_description=QUERYWISE_CD_FILE)
2240 test_pool = Pool(QUERYWISE_TEST_FILE, column_description=QUERYWISE_CD_FILE)
2241 model = CatBoostRanker(loss_function='QueryRMSE', iterations=2, thread_count=8, task_type=task_type, gpu_ram_part=TEST_GPU_RAM_PART, devices='0')
2242 model.fit(train_pool)
2243 pred1 = model.predict(test_pool)
2244
2245 df = pd.read_csv(QUERYWISE_TRAIN_FILE, delimiter='\t', header=None)
2246 train_query_id = df.loc[:, 1]
2247 train_target = df.loc[:, 2]
2248 train_data = df.drop([0, 1, 2, 3, 4], axis=1).astype(eval(features_dtype))
2249
2250 df = pd.read_csv(QUERYWISE_TEST_FILE, delimiter='\t', header=None)
2251 test_data = df.drop([0, 1, 2, 3, 4], axis=1).astype(eval(features_dtype))
2252
2253 model.fit(train_data, train_target, group_id=train_query_id)
2254 pred2 = model.predict(test_data)
2255 assert _check_data(pred1, pred2)
2256
2257
2258def test_group_weight(task_type):

Callers

nothing calls this directly

Calls 7

fitMethod · 0.95
predictMethod · 0.95
PoolClass · 0.90
CatBoostRankerClass · 0.90
dropMethod · 0.80
_check_dataFunction · 0.70
evalFunction · 0.50

Tested by

no test coverage detected