I am going over lesson 5 right now and have written code that is identical to that in the lesson 5 notebook as I follow along the lesson video but ran into a problem when trying to plot losses which I’m not sure how to address
so after writing the update function and creatinng the losses variable, I try to run plt.plot(losses); and it throws this error at me:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-35-62c56432fc0a> in <module>
1 #plot losses saved in variable above
----> 2 plt.plot(losses);
/opt/conda/envs/fastai/lib/python3.6/site-packages/matplotlib/pyplot.py in plot(scalex, scaley, data, *args, **kwargs)
2811 return gca().plot(
2812 *args, scalex=scalex, scaley=scaley, **({"data": data} if data
-> 2813 is not None else {}), **kwargs)
2814
2815
/opt/conda/envs/fastai/lib/python3.6/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1808 "the Matplotlib list!)" % (label_namer, func.__name__),
1809 RuntimeWarning, stacklevel=2)
-> 1810 return func(ax, *args, **kwargs)
1811
1812 inner.__doc__ = _add_data_doc(inner.__doc__,
/opt/conda/envs/fastai/lib/python3.6/site-packages/matplotlib/axes/_axes.py in plot(self, scalex, scaley, *args, **kwargs)
1610
1611 for line in self._get_lines(*args, **kwargs):
-> 1612 self.add_line(line)
1613 lines.append(line)
1614
/opt/conda/envs/fastai/lib/python3.6/site-packages/matplotlib/axes/_base.py in add_line(self, line)
1893 line.set_clip_path(self.patch)
1894
-> 1895 self._update_line_limits(line)
1896 if not line.get_label():
1897 line.set_label('_line%d' % len(self.lines))
/opt/conda/envs/fastai/lib/python3.6/site-packages/matplotlib/axes/_base.py in _update_line_limits(self, line)
1915 Figures out the data limit of the given line, updating self.dataLim.
1916 """
-> 1917 path = line.get_path()
1918 if path.vertices.size == 0:
1919 return
/opt/conda/envs/fastai/lib/python3.6/site-packages/matplotlib/lines.py in get_path(self)
943 """
944 if self._invalidy or self._invalidx:
--> 945 self.recache()
946 return self._path
947
/opt/conda/envs/fastai/lib/python3.6/site-packages/matplotlib/lines.py in recache(self, always)
643 if always or self._invalidy:
644 yconv = self.convert_yunits(self._yorig)
--> 645 y = _to_unmasked_float_array(yconv).ravel()
646 else:
647 y = self._y
/opt/conda/envs/fastai/lib/python3.6/site-packages/matplotlib/cbook/__init__.py in _to_unmasked_float_array(x)
1363 return np.ma.asarray(x, float).filled(np.nan)
1364 else:
-> 1365 return np.asarray(x, float)
1366
1367
/opt/conda/envs/fastai/lib/python3.6/site-packages/numpy/core/numeric.py in asarray(a, dtype, order)
499
500 """
--> 501 return array(a, dtype, copy=False, order=order)
502
503
TypeError: float() argument must be a string or a number, not 'builtin_function_or_method'
Triered searching on the forums as well as stackoverflow but couldn’t find anythiing - I think it’s to do with passing the data variable into pyplot somewhere?