488a0e81a89b360d77c6cd3e7948b8e667e87775,imblearn/utils/tests/test_validation.py,,test_check_ratio_error,#,36
Before Change
assert_raises_regex(ValueError, "The target "y" needs to have more than 1"
" class.", check_ratio, "auto", np.ones((10, )),
"over-sampling")
assert_raises_regex(ValueError, "When "ratio" is a string, it needs to be"
" one of", check_ratio, "rnd", np.array([1, 2, 3]),
"over-sampling")
def test_ratio_all_over_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
After Change
with raises(ValueError, match=error_regex):
check_ratio("auto", np.ones((10, )), "over-sampling")
error_regex = "When "ratio" is a string, it needs to be one of"
with raises(ValueError, match=error_regex):
check_ratio("rnd", np.array([1, 2, 3]), "over-sampling")
def test_ratio_all_over_sampling():
y = np.array([1] * 50 + [2] * 100 + [3] * 25)
for each in ("all", "auto"):
assert check_ratio(each, y, "over-sampling") == {1: 50, 2: 0, 3: 75}
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: scikit-learn-contrib/imbalanced-learn
Commit Name: 488a0e81a89b360d77c6cd3e7948b8e667e87775
Time: 2017-08-24
Author: mailsik@gmail.com
File Name: imblearn/utils/tests/test_validation.py
Class Name:
Method Name: test_check_ratio_error
Project Name: scikit-learn-contrib/imbalanced-learn
Commit Name: 488a0e81a89b360d77c6cd3e7948b8e667e87775
Time: 2017-08-24
Author: mailsik@gmail.com
File Name: imblearn/utils/tests/test_validation.py
Class Name:
Method Name: test_ratio_dict_error
Project Name: scikit-learn-contrib/imbalanced-learn
Commit Name: 488a0e81a89b360d77c6cd3e7948b8e667e87775
Time: 2017-08-24
Author: mailsik@gmail.com
File Name: imblearn/utils/tests/test_validation.py
Class Name:
Method Name: test_ratio_float_error