Passed
Push — master ( 170db5...8af2aa )
by Shlomi
02:43 queued 58s
created

ethically.fairness.metrics.utils._assert_binary()   A

Complexity

Conditions 3

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
nop 2
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
from sklearn.metrics.classification import _check_targets
2
3
4
def _assert_binary(y1, y2=None):
5
6
    if y2 is None:
7
        y2 = y1
8
9
    y_type, _, _ = _check_targets(y1, y2)
10
11
    if y_type != 'binary':
12
        raise ValueError('y_true and y_pred must be binary.')
13