---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-15-0edb6db6447f> in <module>
23 X_mean = np.mean(X,0)
24 X_reconstructed = reconstruct_data(score,evectors,X_mean,K)
---> 25 plot_MNIST_reconstruction(X ,X_reconstructed)
<ipython-input-4-148b545ffdc9> in plot_MNIST_reconstruction(X, X_reconstructed)
51 for k2 in range(3):
52 k = k+1
---> 53 plt.imshow(np.reshape(X_reconstructed[k,:],(28,28)),extent=[(k1+1)*28,k1*28,(k2+1)*28,k2*28],vmin=0,vmax=255)
54 plt.xlim((3*28,0))
55 plt.ylim((3*28,0))
~/miniconda3/envs/nma/lib/python3.7/site-packages/matplotlib/pyplot.py in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, data, **kwargs)
2649 filternorm=filternorm, filterrad=filterrad, imlim=imlim,
2650 resample=resample, url=url, **({"data": data} if data is not
-> 2651 None else {}), **kwargs)
2652 sci(__ret)
2653 return __ret
~/miniconda3/envs/nma/lib/python3.7/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1563 def inner(ax, *args, data=None, **kwargs):
1564 if data is None:
-> 1565 return func(ax, *map(sanitize_sequence, args), **kwargs)
1566
1567 bound = new_sig.bind(ax, *args, **kwargs)
~/miniconda3/envs/nma/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs)
356 f"%(removal)s. If any parameter follows {name!r}, they "
357 f"should be pass as keyword, not positionally.")
--> 358 return func(*args, **kwargs)
359
360 return wrapper
~/miniconda3/envs/nma/lib/python3.7/site-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs)
356 f"%(removal)s. If any parameter follows {name!r}, they "
357 f"should be pass as keyword, not positionally.")
--> 358 return func(*args, **kwargs)
359
360 return wrapper
~/miniconda3/envs/nma/lib/python3.7/site-packages/matplotlib/axes/_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
5613 resample=resample, **kwargs)
5614
-> 5615 im.set_data(X)
5616 im.set_alpha(alpha)
5617 if im.get_clip_path() is None:
~/miniconda3/envs/nma/lib/python3.7/site-packages/matplotlib/image.py in set_data(self, A)
692 not np.can_cast(self._A.dtype, float, "same_kind")):
693 raise TypeError("Image data of dtype {} cannot be converted to "
--> 694 "float".format(self._A.dtype))
695
696 if not (self._A.ndim == 2
TypeError: Image data of dtype complex128 cannot be converted to float
But why is it not failing on colab? Not 100% sure but I was able to reproduce it locally only inconsistently as I was playing around with numpy versions. I don't think it has anything to do with numpy version per se, but that as I was changing the version I was getting numpys that were linked against different linear algebra libraries.