1.矩阵matrix
(1)定义
矩阵: a matrix is a rectangular array of numbers
dimension of matrix : num of rows * num of cols
(2)元素
(3)加减法
-加法
-乘法
大小x1 | 层数x2 | 市中心距离x3 | 房价y |
100 | 2 | 15 | 1m |
120 | 3 | 20 | 1.5m |
这样的数据用矩阵表示是:
[100 2 15 ] w[w1
[120 3 20 ]. w2
x1 x2 x3 w3 ]
x1*w1+x2*w2+x3*w3=y
之前对向量公示一直是死记硬背,没能体会到它的妙处,
大量的多维的数据放在向量里才能进行快速运算,不然写for循环太麻烦了,
同时向量的列对应另一个向量(或矩阵)的行,这里其实做的类似于汇总得到更精简的结果,因此每个数据都有相对应的数学计算,所以维度要相同。
matrix multiplication is very useful since you can pack a lot of computation into just one multiplication operation
-乘法的属性
不可交换
可结合
identity matrix
attention:一定是n*n !!
-matrix inverse 矩阵的逆
-matrix transpose矩阵的转置
2.向量vector
(1)定义
矩阵:matrix just with one column
dimension of vector :num of elements
(2)元素