lucazav / binclass-tools

The binclass-tools package contains a set of Python wrappers and interactive plots that facilitate the analysis of binary classification problems.
https://medium.com/towards-data-science/finding-the-best-classification-threshold-for-imbalanced-classifications-with-interactive-plots-7d65828dda38
BSD 3-Clause "New" or "Revised" License
75 stars 11 forks source link

Error on small data #2

Closed kliegr closed 1 year ago

kliegr commented 1 year ago

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.

GretaVilla commented 1 year ago

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