Continuing the discussion from Lesson 4 official topic:
Please could somebody tell me why this doesn’t work and how to correct it
https://www.kaggle.com/julianmacnamara/04-mnist-basics-showing-error
Many thanks in advance
All the best
Julian
Continuing the discussion from Lesson 4 official topic:
Please could somebody tell me why this doesn’t work and how to correct it
https://www.kaggle.com/julianmacnamara/04-mnist-basics-showing-error
Many thanks in advance
All the best
Julian
Hi Julian,
Could you please be a bit more specific. I replicated the notebook and ran it without errors.
Regards,
Sahil
Hi Sahil
Many thanks for taking a look at this - much appreciated
It’s odd. In the version I shared there should be a cell
plot_function(f, ‘x’, ‘x**2’)
after
def f(x): return x**2
for some unknown reason it doesn’t seem to be showing up but it throws an error
NameError: name ‘plot_function’ is not defined
I’m using kaggle
All the best
Julian
That’s strange!? The notebook is still the same from my end. If you are still having this issue could you try sharing the link to an updated notebook?
Hi Sunil
Sorry about that. I think it was because I was including “commit” in the save instruction rather than just doing a quick save
Please could you try it now?
Many thanks, once again, for your help
All the best
Julian
Ah, so I think that the function is not in any of the fastai modules anymore so you have to define it yourself. This should work.
def plot_function(f, title=None, min=-2.1, max=2.1, color='r', ylim=None):
x = torch.linspace(min,max, 100)[:,None]
if ylim: plt.ylim(ylim)
plt.plot(x, f(x), color)
if title is not None: plt.title(title)
To plot the function you can use: plot_function(f)
Hi Sahil
Many thanks for taking the trouble to help me with this. It is much appreciated
All the best
Julian
Hello Sahil. Thanks for this bug fix