How to predict unseen tabular test data (regression) with fastai v1

I know this has been asked before a few times (here, here, here, and here) but I can’t find a solution that works for me. I have a tabular dataset containing both continuous and categorical variables. I now have a trained model as a pkl file and would like to make predictions on a new test set (in the form of a dataframe).

According to the docs, there are two ways to make predictions: on a single row and on an entire dataframe. I am able to make predictions on a single row - learn.predict(df.iloc[0]), but when I try to make on the entire test set (as shown in the docs):
dl = learn.dls.test_dl(test_df)
learn.get_preds(dl=dl)

I get:
AttributeError: 'Learner' object has no attribute 'dls'

I would really appreciate if someone can help me with that and write the correct syntax to make predictions on a test set for regression problem using fastai v1 tabular API.

The solution I found was simply to work with fastai v2

could you share the solution. i’m trying to predict on unseen test data. i’m stuck at how to transform test data using tabularpandas as it needs y_names ?

Hi, just follow the instruction here:

This is how I implemented it:
dl = learn.dls.test_dl(test)
preds = learn.get_preds(dl=dl)[0].numpy()

where test is my test DataFrame, learn is the model, and the [0].numpy is just to organize the predictions so it will be more convenient for me later.