lucazav / binclass-tools

The binclass-tools package contains a set of Python wrappers and interactive plots that facilitate the analysis of binary classification problems.

Home Page:https://medium.com/towards-data-science/finding-the-best-classification-threshold-for-imbalanced-classifications-with-interactive-plots-7d65828dda38

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on small data

kliegr opened this issue · comments

commented

Assume the following small test case

y_true=[False,True,True,True,False,False,False]
y_pred_prob=[0.6,0.7,0.4,0.3,0.2,0.15,0.1]
PR_plot, area_under_PR = bc.curve_PR_plot(true_y = y_true, 
                                      predicted_proba = y_pred_prob,
                                      beta = 1)

The package will fail at
--> 676 baseline = len(true_y[true_y==1]) / len(true_y)
TypeError: object of type 'bool' has no len()

The reason seems to be that after the subsetting, the list degenerated to a single item and ceased to be list.

Hi, thanks for reporting this.
The bug was fixed in version 1.1.0.