吴恩达机器学习笔记(三)--线性代数回顾

吴恩达机器学习笔记(三)–线性代数回顾

学习基于:吴恩达机器学习.

1. Matrix and Vector

  • Matrix is a rectangular array of numbers
  • The dimension of matrix is the number of rows and columns of a matrix
  • Matrix elements are entries of matrix
  • A i j A_{ij} Aij refers to the entry in the i t h i^{th} ith row and j t h j^{th} jth column
  • Vector is an n x 1 matrix


    在这里插入图片描述

2. Addition and Scalar Multiplication

  • Addition and subtraction are element-wise, so you simply add or subtract each corresponding element:
    [ a c b d ] + [ w y x z ] = [ a + w c + y b + x d + z ] \left[ \begin{matrix} a & c \\ b & d \end{matrix} \right] + \left[ \begin{matrix} w & y \\ x & z \end{matrix} \right] = \left[ \begin{matrix} a+w & c+y \\ b+x & d+z \end{matrix} \right] [abcd]+[wxyz]=[a+wb+xc+yd+z]
  • Subtracting Matrices:
    [ a c b d ] − [ w y x z ] = [ a − w c − y b − x d − z ] \left[ \begin{matrix} a & c \\ b & d \end{matrix} \right] - \left[ \begin{matrix} w & y \\ x & z \end{matrix} \right] = \left[ \begin{matrix} a-w & c-y \\ b-x & d-z \end{matrix} \right] [abcd][wxyz]=[awbxcydz]

To add or subtract two matrices, their dimensions must be the same.

  • In scalar multiplication, we simply multiply every element by the scalar value:
    [ a c b d ] × λ = [ λ a λ c λ b λ d ] \left[ \begin{matrix} a & c \\ b & d \end{matrix} \right] \times \lambda = \left[ \begin{matrix} \lambda a & \lambda c \\ \lambda b & \lambda d \end{matrix} \right] [abcd]×λ=[λaλbλcλd]

3. Matrix-Matrix Multiplication

1) Matrix-Vector Multiplication

We map the column of the vector onto each row of the matrix, multiplying each element and summing the result.
[ a c b d ] × [ x y ] = [ a x + c y b x + d y ] \left[ \begin{matrix} a & c \\ b & d \end{matrix} \right] \times \left[ \begin{matrix} x \\ y \\ \end{matrix} \right]= \left[ \begin{matrix} ax+cy \\ bx+dy \end{matrix} \right] [abcd]×[xy]=[ax+cybx+dy]
An m x n matrix multiplied by an n x 1 vector results in an m x 1 vector.

2) Matrix-Matrix Multiplication

We multiply two matrices by breaking it into several vector multiplications and concatenating the result.
[ a c b d ] × [ w y x z ] = [ a w + c x a y + c z b w + d x b y + d z ] \left[ \begin{matrix} a & c \\ b & d \end{matrix} \right] \times \left[ \begin{matrix} w & y \\ x & z \end{matrix} \right]= \left[ \begin{matrix} aw+cx & ay+cz \\ bw+dx & by+dz \end{matrix} \right] [abcd]×[wxyz]=[aw+cxbw+dxay+czby+dz]

4. Matrix Multiplication Properties

  • Matrices are not commutative:
    • A × \times ×B ≠ B × \times ×A       (Except B is an unit matrix)
  • Matrices are associative:
    • (A × \times ×B) × \times ×C=A × \times ×(B × \times ×C)

5. Inverse and Transpose

  • The inverse of a matrix A is denoted A − 1 A^{-1} A1. Multiplying by the inverse results in the identity matrix.
    • A A − 1 = A − 1 A = I AA^{-1} = A^{-1}A = I AA1=A1A=I
  • The transposition of a matrix is like rotating the matrix 90° in clockwise direction and then reversing it.
    • B i j = A j i B_{ij} = A_{ji} Bij=Aji
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值