Skip to content

Commit

Permalink
twoclass consistent with multi
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Jun 23, 2020
1 parent 153e1fc commit 2f2b915
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion classeval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

__author__ = 'Erdogan Tasksen'
__email__ = '[email protected]'
__version__ = '0.1.6'
__version__ = '0.1.7'

# module level doc-string
__doc__ = """
Expand Down
6 changes: 6 additions & 0 deletions classeval/classeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ def eval(y_true, y_proba, y_score=None, y_pred=None, pos_label=None, threshold=0
# Create classification report
class_names = np.unique(y_true)
if len(class_names)==2:
if len(np.shape(y_proba))>1:
print('[classeval] In two class evaluation, it is only recomended to specify <y_proba> of interest. The first column is now taken as input.')
y_proba = y_proba[:,0]
if pos_label is None:
print('[classeval] In two class evaluation, it is recomended to specify <pos_label>.')
pos_label = np.unique(y_true)[0]
out = eval_twoclass(y_true, y_proba, threshold=threshold, pos_label=pos_label, normalize=normalize, verbose=verbose)
elif len(class_names)>2:
out = eval_multiclass(y_true, y_proba, y_score, y_pred, normalize=normalize, verbose=verbose)
Expand Down

0 comments on commit 2f2b915

Please sign in to comment.