10000 Add a few more lines to test_grid_search_results(): · scikit-learn/scikit-learn@a7d8c32 · GitHub
[go: up one dir, main page]

Skip to content

Commit a7d8c32

Browse files
Eugene Chenraghavrv
authored andcommitted
Add a few more lines to test_grid_search_results():
1. check test_rank_score always >= 1 2. check all regular scores (test/train_mean/std_score) and timing >= 0 3. check all regular scores <= 1 Note that timing can be greater than 1 in general, and std of regular scores always <= 1 because the scores are bounded between 0 and 1.
1 parent 672a88d commit a7d8c32

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

sklearn/model_selection/tests/test_search.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,13 @@ def test_grid_search_results():
646646
for search, iid in zip((grid_search, grid_search_iid), (False, True)):
647647
assert_equal(iid, search.iid)
648648
results = search.results_
649+
# Check if score and timing are reasonable
650+
assert_true(all(results['test_rank_score'] >= 1))
651+
assert_true(all(results[k] >= 0) for k in score_keys
652+
if k is not 'test_rank_score')
653+
assert_true(all(results[k] <= 1) for k in score_keys
654+
if not k.endswith('time') and
655+
k is not 'test_rank_score')
649656
# Check results structure
650657
check_results_array_types(results, param_keys, score_keys)
651658
check_results_keys(results, param_keys, score_keys, n_candidates)

0 commit comments

Comments
 (0)
0