Fast AI v2 could not infer loss function from the data for tabular learner

Hi All,

Fastai version 2.

I am trying to train a tabular learner using fastai library. These are the steps I followed.

1# Imported libraries

Then I did some exploration and preprocessing until I had the following data:

After that, I received the following error when trying to create the tabular learner

Which says AssertionError: Could not infer loss function from the data, please pass a loss function. It is a regression problem and I want to use RLMSE for which I have log-transformed the target variable.

Any guidance on what would be wrong that fastai can’t infer the loss function?

I will appreciate your guidance and support.

Many Thanks and

Kind Regards,
Bilal

1 Like

Never mind, I was able to resolve the issue by passing y_block=TransformBlock() to TabularPandas() call.

It is working fine now.

Thanks
Bilal

2 Likes