示例#1
0
def test_check_labels_positive_notok():
    y = np.array([1, 1, -1])
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    assert_raises(AttributeError,
                  'y array must not contain negative labels.\nFound [-1  1]',
                  cl._check_target_array,
                  y)
示例#2
0
def test_check_labels_interger_notok():
    y = np.array([1., 2.], dtype=np.float64)
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    assert_raises(AttributeError,
                  'y must be an integer array.\nFound float64',
                  cl._check_target_array,
                  y)
示例#3
0
def test_check_labels_not_ok_1():
    y = np.array([1, 3, 2])
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    assert_raises(AttributeError,
                  'Labels not in {(1, 2), (0, 1)}.\nFound (1, 2, 3)',
                  cl._check_target_array,
                  y,
                  {(0, 1), (1, 2)})
示例#4
0
def test_check_labels_positive_notok():
    y = np.array([1, 1, -1])
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    assert_raises(AttributeError,
                  'y array must not contain negative labels.\nFound [-1  1]',
                  cl._check_target_array, y)
示例#5
0
def test_check_labels_interger_notok():
    y = np.array([1., 2.], dtype=np.float64)
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    assert_raises(AttributeError, 'y must be an integer array.\nFound float64',
                  cl._check_target_array, y)
示例#6
0
def test_check_labels_not_ok_1():
    y = np.array([1, 3, 2])
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    assert_raises(AttributeError,
                  'Labels not in {(1, 2), (0, 1)}.\nFound (1, 2, 3)',
                  cl._check_target_array, y, {(0, 1), (1, 2)})
示例#7
0
def test_check_labels_ok_2():
    y = np.array([1, 2, 2])
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    cl._check_target_array(y=y, allowed={(1, 2), (0, 1)})
示例#8
0
def test_init():
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    assert hasattr(cl, 'print_progress')
    assert hasattr(cl, 'random_seed')
示例#9
0
def test_check_labels_ok_2():
    y = np.array([1, 2, 2])
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    cl._check_target_array(y=y, allowed={(1, 2), (0, 1)})
示例#10
0
def test_init():
    cl = _BaseClassifier(print_progress=0, random_seed=1)
    assert hasattr(cl, 'print_progress')
    assert hasattr(cl, 'random_seed')