NameError: name 'rmse' is not defined

I’ve imported all libraries as shown in many examples:
from import *
from fastai.tabular import *
from fastai import *

When I try to execute
learn = tabular_learner(data, layers=[200,50], ps=[0.001,0.01], emb_drop=0.04,
y_range=y_range, metrics=rmse)

I get:
NameError: name ‘rmse’ is not defined

I have fastai version 1.0.34

What is the problem here? how can I specify the metric to be root mean square error?

1 Like

It’s probably because you have an old version, you should upgrade your library.

I’m having this problem too and I’m using the latest version of fastai (2.7.7). Most of the predefined metrics do not work for me. E.g., if I use mean_squared_error as

learn = tabular_learner(dls, y_range=(1,100), 

I get:

NameError: name ‘mean_squared_error’ is not defined

The same thing happens if I use mean_absolute_error or most of the other predefined metrics. But if I use exp_rmspe. It works fine.
Am I doing something wrong?

There is no metric in fastai called mean_squared_error.

Thank you for your response. I’m confused then, because I see it on this metrics page.

That’s the fastai1 docs. The current version (v2) is at

1 Like