(本文原创于我自己原创的简书文章,时间为
2019.09.28 20:20:46 https://www.jianshu.com/p/9bfa63ec1201)
Deep learning by Andrew NG在Course2的作业挺多坑的,可能是当时他布置作业时的环境比较旧,而现在搭建的Anaconda环境相对较新,有些方法已经不适用而造成的的。
先完成Regularizaion的作业,运行
\COURSE 2 Improving Deep Neural Networks Hyperparameter tuning, Regularization and Optimization\week5\Regularization\Regularization.ipynb
第一坑:
首先踩到的第一个坑是如下提示:
train_X, train_Y, test_X, test_Y = load_2D_dataset()
TypeError Traceback (most recent call last)
d:\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)
173 try:
--> 174 rgba = _colors_full_map.cache[c, alpha]
175 except (KeyError, TypeError): # Not in cache, or unhashable.
TypeError: unhashable type: 'numpy.ndarray'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
d:\Anaconda3\lib\site-packages\matplotlib\axes\_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
4231 try: # Then is 'c' acceptable as PathCollection facecolors?
-> 4232 colors = mcolors.to_rgba_array(c)
4233 n_elem = colors.shape[0]
d:\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba_array(c, alpha)
274 for i, cc in enumerate(c):
--> 275 result[i] = to_rgba(cc, alpha)
276 return result
d:\Anaconda3\lib\site-packages\matplotlib\colors.py in to_rgba(c, alpha)
175 except (KeyError, TypeError): # Not in cache, or unhashable.
--> 176 rgba = _to_rgba_no_colorcycle(c, alpha)
177 try:
d:\Anaconda3\lib\site-packages\matplotlib\colors.py in _to_rgba_no_c