MIT | 数据分析、信号处理和机器学习中的矩阵方法 笔记系列 Lecture 5 Positive Definite and Semidefinite Matrices

本文主要是介绍MIT | 数据分析、信号处理和机器学习中的矩阵方法 笔记系列 Lecture 5 Positive Definite and Semidefinite Matrices,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

本系列为MIT Gilbert Strang教授的"数据分析、信号处理和机器学习中的矩阵方法"的学习笔记。

  • Gilbert Strang & Sarah Hansen | Sprint 2018
  • 18.065: Matrix Methods in Data Analysis, Signal Processing, and Machine Learning
  • 视频网址: https://ocw.mit.edu/courses/18-065-matrix-methods-in-data-analysis-signal-processing-and-machine-learning-spring-2018/
  • 关注下面的公众号,回复“ 矩阵方法 ”,即可获取 本系列完整的pdf笔记文件~

内容在CSDN、知乎和微信公众号同步更新

  • CSDN博客
  • 知乎
  • 微信公众号

在这里插入图片描述

  • Markdown源文件暂未开源,如有需要可联系邮箱
  • 笔记难免存在问题,欢迎联系邮箱指正

Lecture 0: Course Introduction

Lecture 1 The Column Space of A A A Contains All Vectors A x Ax Ax

Lecture 2 Multiplying and Factoring Matrices

Lecture 3 Orthonormal Columns in Q Q Q Give Q ′ Q = I Q'Q=I QQ=I

Lecture 4 Eigenvalues and Eigenvectors

Lecture 5 Positive Definite and Semidefinite Matrices

Lecture 6 Singular Value Decomposition (SVD)

Lecture 7 Eckart-Young: The Closest Rank k k k Matrix to A A A

Lecture 8 Norms of Vectors and Matrices

Lecture 9 Four Ways to Solve Least Squares Problems

Lecture 10 Survey of Difficulties with A x = b Ax=b Ax=b

Lecture 11 Minimizing ||x|| Subject to A x = b Ax=b Ax=b

Lecture 12 Computing Eigenvalues and Singular Values

Lecture 13 Randomized Matrix Multiplication

Lecture 14 Low Rank Changes in A A A and Its Inverse

Lecture 15 Matrices A ( t ) A(t) A(t) Depending on t t t, Derivative = d A / d t dA/dt dA/dt

Lecture 16 Derivatives of Inverse and Singular Values

Lecture 17 Rapidly Decreasing Singular Values

Lecture 18 Counting Parameters in SVD, LU, QR, Saddle Points

Lecture 19 Saddle Points Continued, Maxmin Principle

Lecture 20 Definitions and Inequalities

Lecture 21 Minimizing a Function Step by Step

Lecture 22 Gradient Descent: Downhill to a Minimum

Lecture 23 Accelerating Gradient Descent (Use Momentum)

Lecture 24 Linear Programming and Two-Person Games

Lecture 25 Stochastic Gradient Descent

Lecture 26 Structure of Neural Nets for Deep Learning

Lecture 27 Backpropagation: Find Partial Derivatives

Lecture 28 Computing in Class [No video available]

Lecture 29 Computing in Class (cont.) [No video available]

Lecture 30 Completing a Rank-One Matrix, Circulants!

Lecture 31 Eigenvectors of Circulant Matrices: Fourier Matrix

Lecture 32 ImageNet is a Convolutional Neural Network (CNN), The Convolution Rule

Lecture 33 Neural Nets and the Learning Function

Lecture 34 Distance Matrices, Procrustes Problem

Lecture 35 Finding Clusters in Graphs

Lecture 36 Alan Edelman and Julia Language


文章目录

    • Lecture 5 Positive Definite and Semidefinite Matrices
      • 5.1 Positive Definite Matrix
        • 正定矩阵的性质
        • 正定矩阵的energy function及其在优化理论中的应用
        • 正定矩阵的判定
      • 5.2 Positive Semi-Definite (PSD) Matrix
        • 半正定矩阵的性质
        • 半正定矩阵举例


Lecture 5 Positive Definite and Semidefinite Matrices

5.1 Positive Definite Matrix

正定矩阵的性质

Topics in this lecture:

  • For Symmetric Positive Definite Matrix S S S (实矩阵: 正定矩阵 (一定是对称阵) ⇒ \Rightarrow 且特征值>0)

    1. All λ i \lambda_i λi > 0
    2. Energy x T S x > 0 x^T S x > 0 xTSx>0 (all x ≠ 0 x\not ={0} x=0)
    3. S = A T A S = A^T A S=ATA (independent cols in A)
    4. All leading determinants > 0 > 0 >0
    5. All points in elimination > 0 > 0 >0
  • An Example:

    • S = [ 3 4 4 5 ] S = \begin{bmatrix} 3 & 4\\ 4 & 5 \end{bmatrix} S=[3445]

      S S S is symmetric

  • Is S S S Positive Definite?

    • D e t ( S ) = 15 − 16 = − 1 Det(S) = 15 -16 = -1 Det(S)=1516=1

    • 意味着 λ 1 λ 2 = − 1 \lambda_1 \lambda_2 = -1 λ1λ2=1, 特征值不可能都是正的

  • 如何make S be positive?

    add stuff to the main diagonal ⇒ \Rightarrow make S S S more positive

    ▪ 将S的右下角替换为6

    S = [ 3 4 4 6 ] S = \begin{bmatrix} 3 & 4\\ 4 & 6 \end{bmatrix} S=[3446]

  • 需要 All leading determinants > 0 > 0 >0 pivot

    • S = [ − 3 4 4 − 6 ] S = \begin{bmatrix} -3 & 4\\ 4 & -6 \end{bmatrix} S=[3446] 非正定
  • 再看 All points in elimination > 0 > 0 >0

    ▪ 1st pivot = 3;

    S S S → \rightarrow [ 3 4 0 2 / 3 ] \begin{bmatrix} 3 & 4\\ 0 & 2/3 \end{bmatrix} [3042/3] ⇒ \Rightarrow 2nd pivot = 2 / 3 > 0 2/3 > 0 2/3>0

正定矩阵的energy function及其在优化理论中的应用
  • 关于 Energy x T S x > 0 x^T S x > 0 xTSx>0 (all x ≠ 0 x\not ={0} x=0)
    • f ( x ) = x T S x = [ x 1 x 2 ] [ 3 4 4 6 ] [ x 1 x 2 ] = [ x 1 x 2 ] [ 3 x 1 + 4 x 2 4 x 1 + 6 x 2 ] f(x) = x^T S x = \begin{bmatrix} x_1 & x_2 \end{bmatrix} \begin{bmatrix} 3 & 4\\ 4 & 6 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \end{bmatrix} = \begin{bmatrix} x_1 & x_2 \end{bmatrix} \begin{bmatrix} 3x_1 + 4x_2 \\ 4x_1 + 6x_2 \end{bmatrix} f(x)=xTSx=[x1x2][3446][x1x2]=[x1x2][3x1+4x24x1+6x2] = 3 x 1 2 + 6 x 2 2 + 8 x 1 x 2 3x_{1}^2 + 6 x_{2}^2 + 8x_1 x_2 3x12+6x22+8x1x2

    • f ( x ) f(x) f(x) = 3 x 1 2 + 6 x 2 2 + 8 x 1 x 2 3x_{1}^2 + 6 x_{2}^2 + 8x_1 x_2 3x12+6x22+8x1x2

      ▪ f(x) 关于 x 1 x_1 x1 x 2 x_2 x2的函数如下图所示 (图中使用(x,y)表示 x x x的坐标)

      ▪ 此即 f ( x ) f(x) f(x)能量函数 (Energy function), and a convex function

      ▪ 该能量函数始终大于0 (all x ≠ 0 x\not ={0} x=0) --> 正定矩阵

      ▪ deep learning 中的 loss function 也是此类 energy function ⇒ \Rightarrow minimize the function

    • Therefore, f ( x ) > 0 f(x) > 0 f(x)>0 (for all x ≠ 0 x\not ={0} x=0)

      🚩 对于 quadratic , convex means positive definite / positive semidefinite

      🚩 使用gradient descent 进行求解, the big algorithm of deep learning、 neural nets and machine learning

      🚩 特征值决定了the energy function的形状: If you have a very small eigenvalue and a very large eigenvalue, the shape of the “bowl” will be thin and deep ⇒ \Rightarrow difficult for the gradient descent algorithms !!

      🚩 这也是正定矩阵非常重要的一个原因:能够确定根据损失函数解优化问题的性质,并根据特征值估计难度

1654329264854----Matrix_Gilbert_note.png

正定矩阵的判定
  • Question 1: If S S S and T T T are positive definite matrices, Is S = S 1 + S 2 S = S_1 + S_2 S=S1+S2 a positive definite matrix?

    • S,T are pos. def.

    • What about S+T?

    • 思路:使用最开始的5个test:

      ▪ 1 All λ i \lambda_i λi > 0

      ▪ 2 Energy x T S x > 0 x^T S x > 0 xTSx>0 (all x ≠ 0 x\not ={0} x=0)

      ▪ 3 S = A T A S = A^T A S=ATA (independent cols in A)

      ▪ 4 All leading determinants > 0 > 0 >0

      ▪ 5 All points in elimination > 0 > 0 >0

    • Test 1: Eigenvalues – Eigenvalue of (S+T) is not clear from S and T

    • Test 2: Energy x T ( S + T ) x > 0 ? x^T (S+T) x > 0 ? xT(S+T)x>0? for all x ≠ 0 \not ={0} =0

      ✅ Yes! x T ( S + T ) x = x T S x + x T T x > 0 x^T (S+T) x = x^T S x + x^T T x > 0 xT(S+T)x=xTSx+xTTx>0

      ✅ So the answer is yes: (S+T) is pos. def.

  • Question 2: If S S S is a positive definite matrix, Is S − 1 S^{-1} S1 a positive definite matrix?

    • Test 1: Good!
    • S − 1 S^-1 S1 has eigenvalues 1 / λ 1/\lambda 1/λ
    • So, Yes S − 1 S^{-1} S1 is a positive definite matrix
  • Question 3: If S S S is a positive definite matrix, Is S M SM SM a positive definite matrix? (M is another matrix)

    • ans: the question was not any good

    • S M SM SM is probably not symmetric 只有对称矩阵,才能确保特征值都是实数,才有之前的5个test

    • How about Q T S Q Q^T S Q QTSQ (Q is a orthogonal matrix)

      Q T S Q Q^T S Q QTSQ is a symmetric matrix

      Yes!

      ▪ Test 1: Q T S Q Q^T S Q QTSQ = Q − 1 S Q Q^{-1} S Q Q1SQ 与 matrix S S S similar ⇒ \Rightarrow the consequence of being similar: same eigenvalues Pos. def.

      ▪ Test 2: x T Q T S Q x = ( Q x ) T S ( Q x ) > 0 x^T Q^T S Q x = (Qx)^T S (Qx) > 0 xTQTSQx=(Qx)TS(Qx)>0 ⇒ \Rightarrow Pos. def.

5.2 Positive Semi-Definite (PSD) Matrix

半正定矩阵的性质
  • For Semi-Positive Definite Matrix S S S (实矩阵: 正定矩阵 (一定是对称阵) ⇒ \Rightarrow 且特征值>0)

    1. All λ i \lambda_i λi ≥ \geq 0
    2. Energy x T S x ≥ 0 x^T S x \geq 0 xTSx0 (all x ≠ 0 x\not ={0} x=0)
    3. S = A T A S = A^T A S=ATA (dependent columns allowed)
    4. All leading determinants ≥ 0 \geq 0 0
    5. All points in elimination ≥ 0 \geq 0 0
  • Semi-Positive Definite is the borderline

    • Example: S = [ 3 4 4 16 / 3 ] S = \begin{bmatrix} 3 & 4 \\ 4 & 16/3 \end{bmatrix} S=[34416/3]

    • (Test 1)关于eigenvalues:

      ▪ 根据 determinant ⇒ \Rightarrow λ 2 = 0 \lambda_2 = 0 λ2=0

      ▪ 根据 trace ⇒ \Rightarrow λ 1 = 3 + 16 / 3 \lambda_1 = 3 + 16/3 λ1=3+16/3

半正定矩阵举例
  • An example: S = [ 1 1 1 1 1 1 1 1 1 ] S = \begin{bmatrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{bmatrix} S=111111111
    • Semidef

    • Test 1: Its eigenvalues: {3,0,0}

    • 如何看出来它的特征值? ↓ \downarrow

      🚩 Because the rank is 1 ⇒ \Rightarrow only one non-zero eigenvalues;

      🚩 and the trace is 3 3 3 ⇒ \Rightarrow the eigenvalues are {3,0,0}

    • Test 3: write it as S = A T A S = A^T A S=ATA

      🚩 becaues it is symmetric, it can be write as:

      🚩 S = Q Λ Q T S = Q \Lambda Q^T S=QΛQT = λ 1 q 1 q 1 T + λ 2 q 2 q 2 T + λ 3 q 3 q 3 T \lambda_{1} q_1 q_1^T + \lambda_2 q_2 q_2^T + \lambda_3 q_3 q_3^T λ1q1q1T+λ2q2q2T+λ3q3q3T, 其中 λ 2 \lambda_2 λ2 and λ 3 \lambda_3 λ3 = 0 ⇒ \Rightarrow S = λ 1 q 1 q 1 T = 3 ( [ 1 , 1 , 1 ] T / ( 3 ) ) × [ 1 , 1 , 1 ] / ( 3 ) = q 1 T q 1 S = \lambda_1 q_1 q_1^T = 3 ([1,1,1]^T / (\sqrt{3})) \times [1,1,1] / (\sqrt{3}) = q_1^T q_1 S=λ1q1q1T=3([1,1,1]T/(3 ))×[1,1,1]/(3 )=q1Tq1

Next week:

  • singular value decomposition

这篇关于MIT | 数据分析、信号处理和机器学习中的矩阵方法 笔记系列 Lecture 5 Positive Definite and Semidefinite Matrices的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/700841

相关文章

golang中reflect包的常用方法

《golang中reflect包的常用方法》Go反射reflect包提供类型和值方法,用于获取类型信息、访问字段、调用方法等,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值... 目录reflect包方法总结类型 (Type) 方法值 (Value) 方法reflect包方法总结

C# 比较两个list 之间元素差异的常用方法

《C#比较两个list之间元素差异的常用方法》:本文主要介绍C#比较两个list之间元素差异,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录1. 使用Except方法2. 使用Except的逆操作3. 使用LINQ的Join,GroupJoin

MySQL查询JSON数组字段包含特定字符串的方法

《MySQL查询JSON数组字段包含特定字符串的方法》在MySQL数据库中,当某个字段存储的是JSON数组,需要查询数组中包含特定字符串的记录时传统的LIKE语句无法直接使用,下面小编就为大家介绍两种... 目录问题背景解决方案对比1. 精确匹配方案(推荐)2. 模糊匹配方案参数化查询示例使用场景建议性能优

关于集合与数组转换实现方法

《关于集合与数组转换实现方法》:本文主要介绍关于集合与数组转换实现方法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、Arrays.asList()1.1、方法作用1.2、内部实现1.3、修改元素的影响1.4、注意事项2、list.toArray()2.1、方

Python中注释使用方法举例详解

《Python中注释使用方法举例详解》在Python编程语言中注释是必不可少的一部分,它有助于提高代码的可读性和维护性,:本文主要介绍Python中注释使用方法的相关资料,需要的朋友可以参考下... 目录一、前言二、什么是注释?示例:三、单行注释语法:以 China编程# 开头,后面的内容为注释内容示例:示例:四

一文详解Git中分支本地和远程删除的方法

《一文详解Git中分支本地和远程删除的方法》在使用Git进行版本控制的过程中,我们会创建多个分支来进行不同功能的开发,这就容易涉及到如何正确地删除本地分支和远程分支,下面我们就来看看相关的实现方法吧... 目录技术背景实现步骤删除本地分支删除远程www.chinasem.cn分支同步删除信息到其他机器示例步骤

在Golang中实现定时任务的几种高效方法

《在Golang中实现定时任务的几种高效方法》本文将详细介绍在Golang中实现定时任务的几种高效方法,包括time包中的Ticker和Timer、第三方库cron的使用,以及基于channel和go... 目录背景介绍目的和范围预期读者文档结构概述术语表核心概念与联系故事引入核心概念解释核心概念之间的关系

在Linux终端中统计非二进制文件行数的实现方法

《在Linux终端中统计非二进制文件行数的实现方法》在Linux系统中,有时需要统计非二进制文件(如CSV、TXT文件)的行数,而不希望手动打开文件进行查看,例如,在处理大型日志文件、数据文件时,了解... 目录在linux终端中统计非二进制文件的行数技术背景实现步骤1. 使用wc命令2. 使用grep命令

Python中Tensorflow无法调用GPU问题的解决方法

《Python中Tensorflow无法调用GPU问题的解决方法》文章详解如何解决TensorFlow在Windows无法识别GPU的问题,需降级至2.10版本,安装匹配CUDA11.2和cuDNN... 当用以下代码查看GPU数量时,gpuspython返回的是一个空列表,说明tensorflow没有找到

XML重复查询一条Sql语句的解决方法

《XML重复查询一条Sql语句的解决方法》文章分析了XML重复查询与日志失效问题,指出因DTO缺少@Data注解导致日志无法格式化、空指针风险及参数穿透,进而引发性能灾难,解决方案为在Controll... 目录一、核心问题:从SQL重复执行到日志失效二、根因剖析:DTO断裂引发的级联故障三、解决方案:修复