Skip to Content
数据科学中的实用线性代数
book

数据科学中的实用线性代数

by Mike X Cohen
May 2025
Beginner to intermediate
328 pages
3h 39m
Chinese
O'Reilly Media, Inc.
Content preview from 数据科学中的实用线性代数

第 14 章 奇异值分解 奇异值分解

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

上一章的内容非常密集!我尽力让它变得易懂、严谨,同时又不纠缠于与数据科学关系不大的细节。

幸运的是,你所学到的关于幂等分解的大部分知识都适用于 SVD。这意味着本章将变得更简单、更简短。

SVD 的目的是将矩阵分解为三个矩阵的乘积,即左奇异向量 ( 𝐔 )、奇异值 (Σ) 和右奇异向量 ( 𝐕 ):

A = U Σ V T

这种分解看起来应该与 "秭归分解 "类似。事实上,你可以将 SVD 视为 eigendecomposition 对非方阵矩阵的推广,或者将 eigendecomposition 视为 SVD 对方阵矩阵的特例。1

奇异值相当于特征值,而奇异向量矩阵相当于特征向量(这两组量在某些情况下是相同的,我稍后会解释)。

SVD 的全貌

我想先向大家介绍矩阵的概念和解释,然后在本章后面的内容中介绍如何计算 SVD。

图 14-1显示了 SVD 的概览。

The SVD
图 14-1. SVD 大图

从这张图中可以看到 SVD 的许多重要特征;我将在本章中详细介绍这些特征, ,但要把它们列成一个清单:

  • 都是 𝐔 𝐕 都是正方形矩阵,即使 𝐀 也是非正方形矩阵。

  • 奇异向量的矩阵 𝐔 𝐕 是正交的,即 𝐔 T 𝐔 = 𝐈 𝐕 T 𝐕 = 𝐈 .提醒一下,这意味着每一列与其他每一列都是正交的,而且任何一列的子集都与其他任何一列(非重叠)的子集是正交的。

  • 的前r 𝐔 的列空间提供正交基向量。 𝐀 的列空间提供正交基向量,而其余列则为左空空间提供正交基向量(除非r=M,在这种情况下,矩阵为全列秩,左空空间为空)。

  • 的前r 𝐕 T 的列 𝐕 为行空间提供正交基向量,其余各行为空空间提供正交基向量。

  • 奇异值矩阵是一个对角矩阵,其大小与 𝐀 .奇异值总是从大(左上角)到小(右下角)排序。

  • 所有奇异值都是非负的实值。即使矩阵包含复数值,它们也不能是复数或负数。

  • 非零奇异值的数量等于矩阵秩。

SVD 最神奇的地方或许在于它揭示了矩阵的所有四个子空间:𝐔的前r列和最后M-r列跨越了列空间和左空空间。 𝐔 的前r列和最后N-r列跨越行空间和空空间。 𝐕 T .对于矩形矩阵,如果r=M,则左空空间为空;如果r=N,则空空间为空。

奇异值与矩阵秩

矩阵的秩定义为非零奇异值的个数。 原因来自前面的讨论,即矩阵的列空间和行空间被定义为左奇异矢量和右奇异矢量,它们通过相应奇异值的缩放在矩阵空间中具有一定的 "体积",而左空空间和右空空间被定义为缩放为零的左奇异矢量和右奇异矢量。因此,列和行空间的维度取决于非零奇异值的数量。

事实上,我们可以窥探 NumPy 函数np.linalg.matrix_rank ,看看 Python 是如何计算矩阵秩的(我对代码稍作了编辑,以突出关键概念):

S = svd(M,compute_uv=False) # return only singular values
tol = S.max() * max(M.shape[-2:]) * finfo(S.dtype).eps
return count_nonzero ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

基于scikit-learn和PyTorch的实践机器学习

基于scikit-learn和PyTorch的实践机器学习

Aurélien Géron
Python算法交易实战

Python算法交易实战

Posts & Telecom Press, Sebastien Donadio
AI工程

AI工程

Chip Huyen

Publisher Resources

ISBN: 9798341657236