如果是from matplotlib_inline import backend_inline
ModuleNotFoundError: No module named ‘matplotlib_inline’
或者改为 from matplotlib-inline import backend_inline,也有问题
File “”, line 2
from matplotlib-inline import backend_inline
^
SyntaxError: invalid syntax
这个教程推导用的是分母布局,你的回答是分子布局的结果,都应该是正确的
我和你遇到的情况一样,跟你的情况完全一样
#@save为什么可以将写的函数放到d2l中呢,希望大家可以解答一下,或者这个符号是在哪个地方定义的呢,求指点
如果我们把这个参数增加 或减少 一个无穷小的量
“无穷小的量”是否改为“长度无穷小的量”更准确一些?
我的理解是这属于翻译问题,#@save说明说是“已经保存在d2l”,而不是“将会保存在”。
plot函数中的
if len(X) != len(Y):
X = X * len(Y)
怎么理解,具体有什么用呢
d2l库里面已经保存了,意思是,给你看一下代码,你要用可以直接在d2l里面调用
没有答案可以看一下做的对不对么,为啥还要输入20字啊
第一个是 $A$ 第二个是$A^T$ 吧
我也有No module named 'matplotlib_inline’的问题还是不知道怎么解决
我是这样理解的哈 。pdf文档第二个结果应该是w的转置。书中的第一个A转置是为了方便梯度下降的时候与x相加方便,正好A的转置的一行求和在和x相加。x也是个列向量。pdf中的原始的w矩阵,每一列刚好是各个y对x_i的影响,所以w矩阵列元素相加以后就是梯度下降计算的delta,这个时候是一个行向量显然不方便运算,转置一下正好和同是列向量的x相减方便。
1、
code:
def f(x):
return x**3 - 1/x
x = np.arange(0, 3, 0.1)
plot(x, [f(x), 4*x -4], ‘x’, ‘f(x)’, legend=[‘f(x)’, ‘Tangent line (x=1)’])
result:
2、the answer of the second question:
[6x1, 5e**x2]T
我想问一个问题,怎么样查看d2l.plt.gca()这个函数的用法,或者如何查看其源码?(书籍P66
pypi上的d2l包,我的IPython版本已经弃用了set_matplotlib_formats (参考这个issue:Deprecated use of IPython.display.set_matplotlib_formats · Issue #1842 · scverse/scanpy · GitHub)
如果出现IPython报AttributeError说找不到set_matplotlib_formats属性,可能就是这个原因
我的解决办法:在 d2l/tensorflow.py中添加如下代码:
import warnings
# Issue: Deprecated use of IPython.display.set_matplotlib_formats #1842
try:
warnings.showwarning("[ Info ] IPython.display.set_matplotlib_formats is deprecated, use matplotlib_inline.backend_inline.set_matplotlib_formats instead", DeprecationWarning, __file__, 1)
try:
IPythonDisplaySetMatplotlibFormats_ = display.set_matplotlib_formats
except AttributeError:
pass
import matplotlib_inline.backend_inline
display.set_matplotlib_formats = matplotlib_inline.backend_inline.set_matplotlib_formats
warnings.showwarning("[Succeed] IPython.display.set_matplotlib_formats is deprecated, use matplotlib_inline.backend_inline.set_matplotlib_formats instead", DeprecationWarning, __file__, 1)
except ImportError:
warnings.showwarning("[ Info ] cannot import matplotlib_inline.backend_inline, using IPython.display.set_matplotlib_formats instead", ImportError, __file__, 1)
display.set_matplotlib_formats = IPythonDisplaySetMatplotlibFormats_
warnings.showwarning("[Succeed] IPython.display.set_matplotlib_formats is deprecated, use matplotlib_inline.backend_inline.set_matplotlib_formats instead", DeprecationWarning, __file__, 1)
finally:
try:
del IPythonDisplaySetMatplotlibFormats_
except NameError:
warnings.showwarning("[ Info ] hook failed, continue...", NameError, __file__, 1)
pass
或者直接用本书github仓库里的d2l,那个是直接用的matplotlib_inline.backend_inline.set_matplotlib_formats