Re: Rossmann - How do we process and make predictions against the test set?

Hey WG,
When you use a datablock API, before calling .databunch() you can add a test set (More here https://docs.fast.ai/data_block.html#Add-a-test-set)

For Rossman competition the call would be the following:

data = (TabularList.from_df(df, path=path, cat_names=cat_vars, cont_names=cont_vars, procs=procs)
                   .split_by_idx(valid_idx)
                   .label_from_df(cols=dep_var, label_cls=FloatList, log=True)
                   .add_test(ItemList.from_df(test_df,path))
                   .databunch()) 

Concerning predictions. I adjusted Radek’s starter code for quick draw challenge:

preds, _ = learn.get_preds(ds_type=DatasetType.Test)
key_ids = test_df['Id']
labels = np.exp(preds.numpy())
sub = pd.DataFrame({'Id': key_ids, 'Sales': labels[:,0]})
5 Likes