%matplotlib inline
IPython有一组预先定义好的所谓的魔法函数,你可以通过命令行的语法形式来访问它们。这就是一个Magic Function
具体作用是当你调用matplotlib.pyplot的绘图函数plot()进行绘图的时候,或者生成一个figure画布的时候,可以直接在你的python console里面生成图像。
通常情况下,执行plt.plot(x, y)后不会将图像给画出来,还需要执行plt.show()之后,图像才会顺利的显示出来。但是由于%matplotlib inline这个魔法函数的存在,即使没有执行plt.show()这行代码,图像也会显示出来。
为什么深度学习中经常使用numpy库而不是math库
Actually, we rarely use the “math” library in deep learning because the inputs of the functions are real numbers. In deep learning we mostly use matrices and vectors. This is why numpy is more useful.
In fact, if 𝑥=(𝑥1,𝑥2,…,𝑥𝑛) is a row vector then 𝑛𝑝.𝑒𝑥𝑝(𝑥) will apply the exponential function to every element of x. The output will thus be: 𝑛𝑝.𝑒𝑥𝑝(𝑥)=(𝑒𝑥1,𝑒𝑥2,…,𝑒𝑥𝑛)
numpy对向量做的操作是在向量元素上做的操作。
numpy的官方文档:https://docs.scipy.org/doc/numpy-1.10.1/index.html
np.shape 和 np.reshape
numpy.reshape()的官方文档
https://numpy.org/doc/stable/reference/generated/numpy.reshape.html
reshape中参数为-1的意义:-1是模糊控制的意思 比如reshape(-1,2) 即固定2列 多少行不知道
np.linalg模块
主要包含线性代数的函数,使用这个模块,可以计算逆矩阵、求特征值,解线性方程组等。
一些向量的乘法
DOT
OUTER
ELEMENTWISE
GENERAL DOT
一些包
h5py is a common package to interact with a dataset that is stored on an H5 file.
matplotlib is a famous library to pl