【学习笔记】吴恩达机器学习 | 第三章 | 线性代数

在这里插入图片描述

简要声明


  1. 课程学习相关网址
    1. Bilibili
    2. 网易云课堂
    3. 学习讲义
  2. 由于课程学习内容为英文,文本会采用英文进行内容记录,采用中文进行简要解释。
  3. 本学习笔记单纯是为了能对学到的内容有更深入的理解,如果有错误的地方,恳请包容和指正。
  4. 非常感谢Andrew Ng吴恩达教授的无私奉献!!!

专有名词


Matrix矩阵Vector向量
index下标Matrix Addition矩阵加法
Scalar Multiplication标量乘法commutative乘法交换律
Associative乘法结合律Identity Matrix单位矩阵
Matrix inverse矩阵的逆Matrix Transpose矩阵转置

Matrices and vectors


Matrix

  1. Matrix: Rectangular array of numbers →矩阵:由数字组成的矩形阵列
  2. Dimension of matrix: number of rows x number of columns →矩阵的维数:矩阵的行数乘以列数

A = [ 1402 191 1371 821 949 1437 147 1448 ] ( R 4 × 2 ) A=\begin{bmatrix} 1402 & 191 \\ 1371 & 821 \\ 949 & 1437 \\ 147 & 1448 \end{bmatrix} \quad (\mathbf{R}^{4 \times 2} ) A= 1402137194914719182114371448 (R4×2)

  1. Matrix Elements (entries of matrix) →矩阵元素/矩阵的项→矩阵的第i行第j列对应的那个元素

A i j = " i , j   e n t r y "   i n   t h e   i t h   r o w ,   j t h   c o l u m n A_{ij}="i,j\ entry"\ in\ the\ i^{th}\ row,\ j^{th}\ column Aij="i,j entry" in the ith row, jth column

Vector

  1. Vector: An n x 1 matrix →一个n×1的矩阵

y = [ 460 232 315 178 ] ( R 4 ) y=\begin{bmatrix} 460 \\ 232 \\ 315 \\ 178 \end{bmatrix} \quad (\mathbf{R}^{4} ) y= 460232315178 (R4)

  1. Vector Element →向量y的第i个元素

y i = i t h   e l e m e n t y_i=i^{th} \ element yi=ith element

  1. Vector index向量下标: 1‐indexed vs 0­‐indexed
  2. 除非特别指定,默认使用1-indexed下标向量

y ( 1 − i n d e x ) = [ y 1 y 2 y 3 y 4 ] y ( 0 − i n d e x ) = [ y 0 y 1 y 2 y 3 ] y_{(1-index)}=\begin{bmatrix} y_1 \\ y_2 \\ y_3 \\ y_4 \end{bmatrix} \qquad y_{(0-index)}=\begin{bmatrix} y_0 \\ y_1 \\ y_2 \\ y_3 \end{bmatrix} y(1index)= y1y2y3y4 y(0index)= y0y1y2y3

  1. 通常使用大写字母表示矩阵,使用小写字母表示数字、标量、向量

Addition and scalar multiplication


Matrix Addition 矩阵加法

  1. 只有相同维度的两个矩阵才能相加

在这里插入图片描述

Scalar Multiplication 标量乘法

在这里插入图片描述

  1. scalar标量指的是实数
  2. 将矩阵中的所有元素乘以或除以实数→得到相同维度的矩阵

Combination of Operands

在这里插入图片描述

  1. 先乘除后加减

Matrix­‐vector multiplication


在这里插入图片描述

  1. 矩阵m×n乘以向量n×1得到向量m×1
  2. 让矩阵A的第i行元素分别乘以向量x中的元素并且相加起来

在这里插入图片描述

  1. 构造一个矩阵(第一列都是1,第二列是数据x),构造一个向量(参数),矩阵和向量相乘得到预测结果向量
prediction = dataMatrix * paeameters
  1. 在计算机中矩阵运算不仅可以简化代码,还可以提高计算效率

Matrix-­matrix multiplication

在这里插入图片描述

  1. 矩阵m×n乘以矩阵n×o得到矩阵m×o
  2. 让矩阵A的第i行元素分别乘以矩阵B的第j列元素并且相加起来得到矩阵C的第i行第i列元素

在这里插入图片描述

  1. 构造一个矩阵(第一列都是1,第二列是数据x),构造一个矩阵(每一列是一个假设函数的参数),矩阵和矩阵相乘得到不同假设函数的预测结果矩阵

Matrix multiplication properties

Not commutative 矩阵乘法没有乘法交换律

在这里插入图片描述

Associative 矩阵乘法有乘法结合律

在这里插入图片描述

Identity Matrix 单位矩阵

在这里插入图片描述

  1. 不同的单位矩阵有不同的维度,单位矩阵对角线上都是1,其他位置都是0
  2. 对于任何矩阵A,A乘以单位矩阵等于I乘以A等于A(矩阵A与单位矩阵I维度匹配)

Inverse and transpose


Matrix inverse 矩阵的逆

  1. If A is an m x m matrix, and if it has an inverse →如果A是m×m的矩阵(方阵)而且可逆

A A − 1 = A − 1 A = I AA^{-1}=A^{-1}A=I AA1=A1A=I

  1. Matrices that don’t have an inverse are “singular” or “degenerate” →没有逆矩阵的矩阵称为奇异矩阵或退化矩阵

Matrix Transpose 矩阵的转置运算

在这里插入图片描述

  1. 假设A是一个m×n矩阵,并设矩阵B等于A的转置,那么B是一个n×m的矩阵,矩阵B的第i行第j列元素等于矩阵A的第j行第i列元素

吴恩达教授语录


  • “Certainly all the top ten most popular programming languages will have great linear algebra libraries.”
  • “There are very goo free libraries that you can use to do this matrix-matrix multiplication very efficiently.”
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Chency.

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值