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

Function test_randomized_search

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

Source from the content-addressed store, hash-verified

3943
3944
3945def test_randomized_search(task_type):
3946 pool = Pool(TRAIN_FILE, column_description=CD_FILE)
3947 model = CatBoost(
3948 {
3949 "learning_rate": 0.03,
3950 "loss_function": "Logloss",
3951 "eval_metric": "AUC",
3952 "task_type": task_type,
3953 "gpu_ram_part": TEST_GPU_RAM_PART,
3954 }
3955 )
3956 feature_border_type_list = ['Median', 'Uniform', 'UniformAndQuantiles', 'MaxLogSum']
3957 one_hot_max_size_list = [4, 7, 10]
3958 iterations_list = [5, 7, 10]
3959 border_count_list = [4, 10, 50, 100]
3960 results = model.randomized_search(
3961 {
3962 'feature_border_type': feature_border_type_list,
3963 'one_hot_max_size': one_hot_max_size_list,
3964 'iterations': iterations_list,
3965 'border_count': border_count_list
3966 },
3967 pool
3968 )
3969 assert "train-Logloss-mean" in results['cv_results'], '"train-Logloss-mean" not in results'
3970
3971 prev_value = results['cv_results']["train-Logloss-mean"][0]
3972 for value in results['cv_results']["train-Logloss-mean"][1:]:
3973 assert value < prev_value, 'not monotonic Logloss-mean'
3974 prev_value = value
3975
3976 assert results['params'].get('feature_border_type') in feature_border_type_list
3977 assert results['params'].get('one_hot_max_size') in one_hot_max_size_list
3978 assert results['params'].get('iterations') in iterations_list
3979 assert results['params'].get('border_count') in border_count_list
3980
3981
3982def test_randomized_search_only_dist(task_type):

Callers

nothing calls this directly

Calls 4

randomized_searchMethod · 0.95
PoolClass · 0.90
CatBoostClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected