How to add test set to tabular databunch?

All of the examples I see for adding a test set to the databunch is from vision. There is the command add_test_folder. But how do I add a test set from a tabular databunch:

data = (TabularList.from_df(df, cat_names=cat_vars, cont_names=cont_vars, procs=procs)
                   .split_by_idx(valid_idx)
                   .label_from_df(cols=dep_var, label_cls=CategoryList)
                   .databunch())

This just returns a train and valid set in the databunch, but no test set. Is there a similar command for tabular data?

I’m getting error for using add_test

data = (TabularList.from_df(df, cat_names=cat_vars, cont_names=cont_vars, procs=procs)
                   .split_by_idx(valid_idx)
                   .add_test(df_test, label='dep')
                   .label_from_df(cols=dep_var, label_cls=CategoryList)
                   .databunch())


AttributeError: 'TabularList' object has no attribute 'add_test'
2 Likes

Hi,
i was able to add a test folder with a separate test csv file by using .add_test_folder(test_folder=testDir,label=‘Target’)

let me know if this works for you