Building databunch for tabularData to solve regression problem

I’m facing issue while using TabularLearner for data for predicting regession values:
Below is my code snippet:

data = (TabularList.from_df(train,cat_names=cat_var, cont_names=cont_var, procs=procs)
                            .label_from_df(cols=dep_var,label_cls=FloatList, log=True)
                            .add_test(TabularList.from_df(test,cat_names=cat_var, cont_names=cont_var, procs=procs))

learn = tabular_learner(data, layers=[100,200,400,800,400,200,100], metrics='root_mean_squared_error')


Can anyone tell me what I’m doing wrong

Hi Bipin,

It should be metrics=root_mean_squared_error (without quotes ’ ') when using predefined metrics in fastai. When you have it in quotes, it gets passed as a string (str), and gave the AttributeError in your screenshot.

Have a look at the fastai metrics docs.


Thanks Very much. That worked!