test class_weights in grid_search
@@ -2702,6 +2702,21 @@ def test_randomized_search_cv(task_type):
assert results['params']['iterations'] in [1, 2, 3]
+def test_grid_search_with_class_weights_lists():
+ pool = Pool(TRAIN_FILE, column_description=CD_FILE)
+ model = CatBoostClassifier(iterations=10)
+ grid = {
+ 'learning_rate': [0.03, 0.1],
+ 'depth': [4, 6, 8],
+ 'l2_leaf_reg': [1, 3, 5, 7],
+ 'class_weights': [[1, 2], [1, 3]]
+ }
+
+ results = model.grid_search(grid, pool, shuffle=False, verbose=False)
+ for key, value in results["params"].iteritems():
+ assert value in grid[key]
+
+
def test_grid_search_wrong_param_type(task_type):
pool = Pool(TRAIN_FILE, column_description=CD_FILE)
model = CatBoost(
