I am having issues using the TabularPandas object.
When requesting the object definition with
TabularPandas??
the following is printed:
Object `TabularPandas` not found.
And when using it to assign categorical and continuous variables, as lesson 9 suggested, by running
to = TabularPandas(df, procs, cat, cont, y_names = input, splits = splits)
the following name error is printed:
NameError: name 'TabularPandas' is not defined
My understanding is that TabularPandas is defined in the fastai library. I have included the collaborative filtering, and tabular portions of the library and all of pandas:
from fastai.collab import *
from fastai.tabular import *
from pandas import *
Am I missing a library? Was TabularPandas updated or changed in recent iterations of the fastai library?
Help is appreciated.
-Simon
It appears as if the library to include has changed from fastai.tabular to fastai.tabular.core. This resolved the issue I had and is consistent with current documentation .
muellerzr
(Zachary Mueller)
March 8, 2022, 10:20pm
3
You’re trying to import fastai the old way. Do from fastai.tabular.all import *
This gives the error
ModuleNotFoundError: No module named 'fastai.tabular.all'
This worked once but is not a sustainable solution.
muellerzr
(Zachary Mueller)
March 8, 2022, 10:35pm
6
simonvincenthk:
sustainable solution.
Are you sure fastai v2 is installed? If it’s in colab you need to run pip install fastai -U each time.
You can check with pip show fastai
I was not on version 2, but I have upgraded now by running
!pip install fastai -Uqq
from fastai.tabular.all import * still does not work and now gives the following error:
ModuleNotFoundError: No module named 'fastai.callback.all'; 'fastai.callback' is not a package
muellerzr
(Zachary Mueller)
March 8, 2022, 10:51pm
8
Restart your runtime then try
Yes, this worked.
The original issue occurred because an out-of-date version of the fastai library and out-of-date import commands were used.
The solution has been to
make sure the most current version of fastai is being used by running !pip install fastai -Uqq (-U indicates that the library should be updated),
restart the runtime using Runtime > Restart runtime in the menu, and
import fastai.tabular.all instead of fastai.tabular or fastai.tabular.core with the following line of code:
from fastai.tabular.all import *
Thank you @muellerzr .
1 Like
Any ideas why dtreeviz would not be working despite including the updated library with
!pip install -Uqq waterfallcharts treeinterpreter dtreeviz
?
Running
dtreeviz(m,xs.iloc[samp_idx],y.iloc[samp_idx],xs.columns,"input",fontname='DejaVu Sans',scale = 1.6,label_fontsize=10,orientation='LR')
throws the following error:
NameError: name 'dtreeviz' is not defined
1 Like