Total Complexity | 4 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import pandas as pd |
||
2 | from sklearn.metrics._classification import _check_targets |
||
3 | |||
4 | |||
5 | def _assert_binary(y1, y2=None): |
||
6 | |||
7 | if y2 is None: |
||
8 | y2 = y1 |
||
9 | |||
10 | y_type, _, _ = _check_targets(y1, y2) |
||
11 | |||
12 | if y_type != 'binary': |
||
13 | raise ValueError('y_true and y_pred must be binary.') |
||
14 | |||
15 | |||
16 | def _groupby_y_x_sens(y_true, y_score, x_sens): |
||
17 | return (pd.DataFrame({'y_true': y_true, |
||
18 | 'y_score': y_score, |
||
19 | 'x_sens': x_sens}) |
||
20 | .groupby('x_sens')) |
||
21 |