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

Function test_fit_with_texts

catboost/python-package/ut/medium/test.py:1476–1506  ·  view source on GitHub ↗
(task_type, problem_type)

Source from the content-addressed store, hash-verified

1474
1475@pytest.mark.parametrize('problem_type', ['binclass', 'multiclass', 'regression', 'multiregression'])
1476def test_fit_with_texts(task_type, problem_type):
1477 if (task_type == 'GPU') and (problem_type == 'multiregression'):
1478 pytest.xfail('Catboost does not support MultiRMSE on GPU yet for categorical features')
1479
1480 params = {
1481 'dictionaries': [
1482 {'dictionary_id': 'UniGram', 'token_level_type': 'Letter', 'occurrence_lower_bound': '1'},
1483 {'dictionary_id': 'BiGram', 'token_level_type': 'Letter', 'occurrence_lower_bound': '1', 'gram_order': '2'},
1484 {'dictionary_id': 'Word', 'occurrence_lower_bound': '1'},
1485 ],
1486 'feature_calcers': ['BoW:top_tokens_count=10'] if 'regression' in problem_type else ['NaiveBayes', 'BoW:top_tokens_count=10'],
1487 'iterations': 100,
1488 'loss_function': {
1489 'binclass': 'Logloss',
1490 'multiclass': 'MultiClass',
1491 'regression': 'RMSE',
1492 'multiregression': 'MultiRMSE'
1493 }[problem_type],
1494 'task_type': task_type,
1495 'gpu_ram_part': TEST_GPU_RAM_PART,
1496 'devices': '0'
1497 }
1498
1499 learn = ROTTEN_TOMATOES_TRAIN_FILE
1500 test = ROTTEN_TOMATOES_TEST_FILE
1501 cd = ROTTEN_TOMATOES_CD_FILE if problem_type == 'multiclass' else ROTTEN_TOMATOES_CD_BINCLASS_FILE
1502
1503 preds1 = fit_from_df(params, learn, test, cd, problem_type == 'multiregression')
1504 if problem_type != 'multiregression':
1505 _, preds2 = fit_from_file(params, learn, test, cd)
1506 assert np.all(preds1 == preds2)
1507
1508
1509def test_coreml_import_export(task_type):

Callers

nothing calls this directly

Calls 3

fit_from_dfFunction · 0.85
fit_from_fileFunction · 0.85
allMethod · 0.45

Tested by

no test coverage detected