Tabular Learner prediction using Data Frame


I’m trying to solve a Kaggle Problem user Fastai’s Tabular Learner Class. I’m able to train the model and I want to get the predictions on the Test set, which is stored in a CSV file. I have created a data frame from the CSV file but I can’t pass the data frame as an input to the learner. I saw the solutions on StackOverFlow and in this forum, but they don’t seem to work.

I saw a suggestion of using = new_df but getting an error 'TabularModel' object has no attribute 'data'.

Any advice on how to best handle such scenarios? Is there a native FastAI method using which we can achieve this goal, instead of using something like dataframe.apply (which is very slow ;’( )

Thank you

1 Like

The following should do:

test_dl = learn.dls.test_dl(test_df)
preds, _ = learn.get_preds(dl=test_dl)

More information, along with common pitfalls & fixes, can be found here.