TabularDataLoaders keeps incorrectly typing my target column as "continuous" instead of "binary", leading to a "ValueError: Can't Handle mix of binary and continuous target"

Was finally able to get something that didn’t crash by getting rid of the y_block argument, adding a “bs=64” parameter (which I doubt makes a lot of difference), so that it now looks like the following:

x["correct"] = x["correct"].astype(int)
dls = TabularDataLoaders.from_df(x, procs=procs, cat_names=cat_names, cont_names=cont_names, 
                                 y_names="correct", valid_idx=valid_idx, bs=64, metrics=f1_score)

I have no idea why that works whereas the earlier version doesn’t, but regardless, perhaps this may help someone else.

1 Like