(task_type, pool, parameters)
| 1535 | |
| 1536 | @pytest.mark.parametrize('pool,parameters', [('adult', {}), ('adult', {'one_hot_max_size': 100}), ('higgs', {})]) |
| 1537 | def test_convert_model_to_json(task_type, pool, parameters): |
| 1538 | train_pool = Pool(data_file(pool, 'train_small'), column_description=data_file(pool, 'train.cd')) |
| 1539 | test_pool = Pool(data_file(pool, 'test_small'), column_description=data_file(pool, 'train.cd')) |
| 1540 | converted_model_path = test_output_path("converted_model.bin") |
| 1541 | parameters.update({'iterations': 20, 'task_type': task_type, 'gpu_ram_part': TEST_GPU_RAM_PART, 'devices': '0'}) |
| 1542 | model = CatBoost(parameters) |
| 1543 | model.fit(train_pool) |
| 1544 | output_model_path = test_output_path(OUTPUT_MODEL_PATH) |
| 1545 | output_json_model_path = test_output_path(OUTPUT_JSON_MODEL_PATH) |
| 1546 | model.save_model(output_model_path) |
| 1547 | model.save_model(output_json_model_path, format="json") |
| 1548 | model2 = CatBoost() |
| 1549 | model2.load_model(output_json_model_path, format="json") |
| 1550 | model2.save_model(converted_model_path) |
| 1551 | pred1 = model.predict(test_pool) |
| 1552 | pred2 = model2.predict(test_pool) |
| 1553 | assert _check_data(pred1, pred2) |
| 1554 | subprocess.check_call(( |
| 1555 | model_diff_tool, output_model_path, converted_model_path, |
| 1556 | '--diff-limit', '0.000001', |
| 1557 | '--ignore-keys', '.*TargetBorderClassifierIdx', |
| 1558 | )) |
| 1559 | return compare_canonical_models(converted_model_path) |
| 1560 | |
| 1561 | |
| 1562 | def test_coreml_cbm_import_export(task_type): |
nothing calls this directly
no test coverage detected