首页 > 其他分享 >【智应数】Singular Value Decomposition

【智应数】Singular Value Decomposition

时间:2024-05-14 20:21:49浏览次数:17  
标签:Vert bm Value Decomposition text Let sigma 智应数 matrix

SVD

Def (eigenvalue\eigenvector). Eigenvalue \(\lambda\) and eigenvector \(\bm{v}\) of matrix \(A\) satisfy $$A\bm{v}=\lambda\bm{v}.$$

Lem 1. Let \(M\in\mathbb{R}^{n\times n}\) is a symmetric matrix. Let \(\lambda_i\) and \(\bm{u}_i\) be the eigenvalues and eigenvectors of \(M\),

\[M=\sum_i\lambda_i\bm{u}_i\bm{u}_i^T. \]

i.e., let \(U\) be the orthonormal matrix spanned by eigenvectors, \(D\) be the diagonal matrix generated by eigenvalues,

\[M=UDU^T. \]

Pf. Only need to prove \(U^TMU=D\). By definition, \(\bm{u_1}^TM\bm{u_1}=\lambda_1\) and \(W_1^TM\bm{u}_1=\vec{0}\). Using induction immediately prove it.

Lem 2. Suppose \(\bm{v}\) is a eigenvector of \(A^TA\), then \(A\bm{v}\) is a eigenvector of \(AA^T\), with same eigenvalue. \(A^TA\) and \(AA^T\) share same non-negative eigenvalues.

Pf.

\[A^TA\bm{v}=\lambda\bm{v} \]

\[\Rightarrow AA^TA\bm{v}=A\lambda\bm{v} \]

\[\Rightarrow (AA^T)(A\bm{v})=\lambda (A\bm{v}). \]

Thm (SVD). Let \(M\in\mathbb{R}^{m\times n}\) is a arbitrary matrix. Let \(\sigma_i,\bm{u}_i\bm{v}_i\) be the square root of singular values, left singular vectors and right singular vectors,

\[M=\sum\limits_{i}\sigma_i\bm{u}_i\bm{v}_i^T. \]

i.e., let \(S,U,V\) be corresponding matrix ( \(U\) and \(V\) is orthonormal, \(S\) is diagonal),

\[M=USV^T. \]

Pf. By intuition, \(A^TA=VS^2V^T\) and \(AA^T=US^2U^T\). Thus \(V,U,S\) should be the eigenvectors of \(A^TA\), the eigenvectors of \(AA^T\), and the square root of eigenvalues respectively.

In Lem 2, $$\Vert A\bm{v}\Vert=\sqrt{\bm{v}^T A^TA\bm{v}}= \sqrt{\bm{v}^T\lambda \bm{v}}=\sqrt{\lambda} \Vert\bm{v}\Vert.$$

It means that if \(V\) is the orthonormal matrix spanned by eigenvectors of \(A^TA\), then \(U=AVS^{-1}\) is the orthonormal matrix spanned by eigenvectors of \(AA^T\). It immediately gives $$U=MVS^{-1}\Rightarrow M=USV^T.$$

Prop. Let \(r=\text{rank}(A)\). We have

  • The first \(r\) columns of \(U\), \(\bm{u}_1,...,\bm{u}_r\) form a orthonormal basis of \(\text{Col}(A)\).
  • The first \(r\) rows of \(V\), \(\bm{v}_1,...,\bm{v}_r\) form a orthonormal basis of \(\text{Row}(A)\).
  • The last \(m-r\) columns of \(U\) form a orthonormal basis of \(\text{Null}(A^T)\).
  • The last \(n-r\) rows of \(V\) form a orthonormal basis of \(\text{Null}(A)\).

Best Rank-\(k\) Approximations

Let \(\sigma_1\ge \sigma_2\ge...\) be the square root of eigenvalues of \(A\). Define

\[A_k=\sum\limits_{i=1}^k \sigma_i \bm{u}_i\bm{v}_i^T. \]

Lem. $$\Vert M\Vert_F ^2 = \text{trace}(M^TM)=\sum\limits_i\sigma_i(M) ^2.$$

Lem. For any \(M\) with \(\text{rank}(M)=k\),

\[\forall i, \sigma_{k+i}(A)\le \sigma_i(A-M). \]

Pf. Since \(\text{rank}(M)=k,\dim(\text{Null}(M))=n-k\), \(\exists \bm{w}\in \text{Null}(M)\cap \text{Span}(\bm{v}_1,...,\bm{v}_k)\).

\[\sigma_{k+1}(A)\Vert \bm{w}\Vert \le \Vert A\bm{w}\Vert\le \Vert (A-M)\bm{w}\Vert\le\sigma_{1}(A-M)\Vert \bm{w}\Vert. \]

Thm. Let \(\Vert M\Vert_F=\sqrt{\sum\limits_{i,j}m_{i,j}^2}\). For any matrix \(B\) of rank at most \(k\), we have $$\Vert A-A_k\Vert_F\le \Vert A-B\Vert_F.$$

Pf. $$\Vert A-A_k\Vert_F^2=\sum\limits_{i=k+1} ^r \sigma_i(A)^2\le \sum\limits_{i=1} ^{r-k}\sigma_i(A-M) ^2\le \Vert A-M\Vert_F^2.$$

Thm. Let \(\Vert M\Vert_2=\sup\limits_{|\bm{x}|=1}|M\bm{x}|\). For any matrix \(B\) of rank at most \(k\), we have $$\Vert A-A_k\Vert_2\le \Vert A-B\Vert_2.$$

Principal Component Analysis (PCA): \(A\rightarrow AV_k\).

Power Method

Let \(B=A^TA=\sum\limits_{i=1}^n\sigma_i^2\bm{v}_i\bm{v}_i^T\). Since \(v_i\) are perpendicular to each others,$$B^k=\sum\limits_{i=1} ^n \sigma_i^{2k} \bm{v}_i\bm{v}_i^T.$$

Let \(\bm{x}=\sum\limits_{i=1}^nc_i\bm{v}_i\) be any vector. When \(k\) is large,

\[B_k\bm{x}=\sum\limits_{i=1} ^n \sigma_i^{2k} \bm{v}_ic_i\bm{x}\approx\sigma_1^{2k}c_1\bm{v}_1. \]

By following the above process, we can obtain \(\sigma_1,\bm{u}_1,\bm{v}_1\). Then let \(B'=B-\sigma_1\bm{v}_1\bm{v}_1^T\) and repeat the process to get \(\sigma_2,...,\sigma_r\).

Thm 3.11. Let \(A\) be an \(n\times d\) matrix and \(\bm{x}\) a unit length vector in \(\mathbb{R}^d\) with \(|\bm{x}^T \bm{v}_1|\ge\delta\), where \(\delta>0\). Let \(V\) be the space spanned by the right singular vectors of \(A\) corresponding to singular values greater than \((1-\varepsilon)\delta_1\). Let \(\bm{w}\) be the unit vector after \(k = \frac{\ln(1/\varepsilon)}{2\varepsilon}\) iterations of the power method, namely,

\[w=\frac{(A^TA)^k\bm{x}}{|(A^TA)^k\bm{x}|}. \]

Then \(w\) has a component of at most \(\varepsilon\) perpendicular to \(V\).

标签:Vert,bm,Value,Decomposition,text,Let,sigma,智应数,matrix
From: https://www.cnblogs.com/xcyle/p/18187726

相关文章

  • 【强化学习】A grid world 值迭代算法 (value iterator algorithm)
    强化学习——值迭代算法代码是在jupyternotebook环境下编写只需要numpy和matplotlib包。此代码为学习赵世钰老师强化学习课程之后,按照公式写出来的代码,对应第四章第一节valueiteratoralgorithm可以做的实验:调整gama值观察策略的变化调整惩罚值(fa)的大小观察......
  • IfcValue
    IfcValue类型定义IfcValue是一种选择类型,用于在更专业的选择类型IFcSimpleValue、IFcMeasureValue和IFcDerivedMeasureValue之间进行选择。IfcSimpleValue简单数据类型的基本定义类型的选择类型。IfcMeasureValueISO10303-41基本度量类型的一种选择类型。BucalDerivedMeasur......
  • java.lang.IllegalArgumentException: Invalid value type for attribute 'factoryBea
    简介前排提示:这个错误一般是由于Spring新版本导致的与其他框架不兼容现象,解决办法一般是升级其他框架版本。使用springboot-3.2.5和myabtis-plus-3.5.0搭建开发环境时,启动Springboot程序时报错,报错信息:点击查看代码java.lang.IllegalArgumentException:Invalidvalu......
  • ValueError: 'a' cannot be empty unless no samples are taken
    Here,Imettheerrormessageasfollows:defmaldroid_noniid(dataset,train_labels,num_users):num_shards,num_imgs=110,120idx_shard=[iforiinrange(num_shards)]dict_users={i:np.array([])foriinrange(num_users)}idxs=np......
  • Object.values()对象遍历
    Object.keys() 对象的遍历 返回给定对象所有可枚举属性的数组;是属性名组成的数组letobj={a:1,b:2,c:3};Object.keys(obj).map((key)=>{console.log(key,obj[key]);}); Object.values() 对象的遍历返回一个给定对象自身的所有属性值的......
  • 返回Rich return value结果思考
    本文是在写过的代码中进行回顾,有理解不对的地方,望请指正!在库(Library)或框架(Framework)设计中,"Richreturnvalue"是指返回值的丰富性,意味着函数返回的不仅仅是一个简单的值,而是一个包含了额外信息的复合类型。这样的设计可以提供更多的上下文信息,方便调用者理解和处理函数的执行......
  • dotnet 9 WPF 支持 Style 的 Setter 填充内容时可忽略 Value 标签
    本文记录WPF在dotnet9的一项XAML编写语法改进点,此改进点用于解决编写Style的Setter进行给Value赋值时,不能将Value当成默认内容,需要多写Value标签的问题。通过此改进点可减少两行XAML代码在原先的WPF版本里面,对Style的Setter填充复杂的对象内容时,大概的......
  • 解决Vue3项目警告:xxxis-declared-but-its-value-is-never-read
    刚刚在Vue3项目引入的一个组件Person下有红线,系统给出了警告,这是因为TypeScript会检查代码中未使用的变量,我定义了'Person'的变量,但是后续代码没有使用到它,从而导致Vetur(Vue的语法检查工具)给出了这个警告。解决方法:方法一:你可以删除或者在代码中使用'Person'变量或类型,以......
  • [20240426]sql_id 转换hash_value.txt
    [20240426]sql_id转换hash_value.txt--//以前写的脚本,转换sql_idtohash_value.遇到问题:$cats2p.sh#!/bin/bash#convertsql_idtohash_valueodebug=${ODEBUG:-0}sql_id="$*"v1=$(echo$sql_id|tr$(echo{0..9}{a..z}|tr-d'eilo')$(echo{0..9}{a.......
  • c# Dictionary<TKey,TValue>.TryAdd
    原文链接:https://learn.microsoft.com/zh-cn/dotnet/fundamentals/code-analysis/quality-rules/ca1864Dictionary<TKey,TValue>.ContainsKey(TKey) 和 Dictionary<TKey,TValue>.Add 都执行查找操作,这是冗余设置。如果字典中已存在键,Dictionary<TKey,TValue>.Add 也会引发异......