SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
線形代数計算の視覚化と
⾏列5分解
〜ストラング先⽣から学んだこと〜
平鍋健児(@hiranabe)
Version 1.0
=
1
これは何?
• Gilbert Strang 著
『Linear Algebra for Everyone』
は線形代数を直感理解するのに
とてもいい本です。
• 定理と証明の連鎖ではなく、マトリックス語法と例⽰で直感的な理解と実⽤的な
応⽤法を得ることができます。
• YouTube の MIT Open Courseware、 先⽣の講義プレイリストである 18.06
と 18.065 には、200万⼈の購読者がいます。(ぼくもその⼀⼈です)
• この本のハイライトは、
• AB=C の4つの⾒⽅
• 基本的な4つの部分空間
• 5つのマトリックス分解
• 通常の線形代数の教科書はジョルダン標準形がクライマックスですが、この
本では、SVD です。そして、
• 機械学習を含むデータサイエンスへの⼊⾨につながっています。
• この1と2のコンセプトをグラフィック表現できないか、というアイディアです。
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 2
1
2
この発表
のモチベ
ーション
• ⾏列とベクトルの掛け算には、複数の⾒⽅
があります。
• このノートは、それらを可視化し、教育⽤
コンテンツとする試みです。
• それによって ...
• ⾏列とベクトルの演算を直感的に⾏えるよう
になります。
• その直感を、5つの⾏列分解法、などのコンセ
プトの理解につなげることができます。
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 3
最新版︓
https://github.com/kenjihiranabe/The-Art-of-Linear-Algebra/
http://math.mit.edu/everyone
5つの⾏列分解
𝐴 = 𝐶𝑅
𝐴 = 𝐿𝑈
𝐴 = 𝑄𝑅
𝑆 = 𝑄Λ𝑄!
𝐴 = 𝑈Σ𝑉!
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 4
独⽴列⾏列と⾏簡約⾏列の積
(⾏ランク=列ランクを⽰す)
LU分解=ガウスの消去法
QR分解=Gram-Schmidtの直⾏化
対称⾏列の固有値分解
どんな⻑⽅⾏列にも使える
特異値分解
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 5
Foreword
I am happy to see Kenji Hiranabeʻs pictures of matrix operations in linear algebra ! The
pictures are an excellent way to show the algebra. We can think of matrix
multiplications by (row, column) dot products, but that is not all -- it is ``linear
combinations” and ``rank 1 matrices" that complete the algebra and the art.
I am very grateful to see the books in Japanese translation and the ideas in Kenji's
pictures.
-- Gilbert Strang
Professor of Mathematics at MIT
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 6
• もうすぐ⽇本語訳発売! • ⽇本語訳決定!
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 7
先⽣の講演例:https://www.youtube.com/watch?v=MsIvs_6vC38
⽬次
• ⾏列の⾒⽅ – 4つ
• ベクトルの積 – 2つ
• ⾏列のベクトルの積 – 2つ
• ⾏列と⾏列の積 – 4つ
• 便利な応⽤パターン– 4つ
• ⾏列の有名分解 – 5つ
• 𝐶𝑅, 𝐿𝑈, 𝑄𝑅, 𝑄Λ𝑄!, 𝑈Σ𝑉!
• データサイエンス応⽤で理解する SVD(今⽇だけ)
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 8
= = =
3つの数からなる
2つの列ベクトル
2つの数からなる
3つの⾏ベクトル
6つの数
1 つの⾏列
⾏列の⾒⽅ – 4つ
𝐴 =
𝑎!!𝑎!"
𝑎"!𝑎""
𝑎#!𝑎#"
=
|
𝒂𝟏
|
|
𝒂𝟐
|
=
−𝒂!
∗ −
−𝒂"
∗ −
−𝒂#
∗ −
以降、太字で列ベクトル𝒂𝟏、*を付けて⾏ベクトル𝒂"
∗
、を表現する。
また、右肩にTをつけて転置ベクトル𝒂𝐓や転置⾏列𝑨𝐓を表現する。
𝐴 =
1 4
2 5
3 6
=
1 4
2 5
3 6
=
1 4
2 5
3 6
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 9
= = =
内積(スカラー) Rank1の⾏列
v1 =
1
2
3
𝑥 𝑦 =
𝑥 𝑦
2𝑥 2𝑦
3𝑥 3𝑦
ベクトルの積 – 2つ
1 2 3
𝑥!
𝑥"
𝑥#
=
1
2
3
,
𝑥!
𝑥"
𝑥#
= 𝑥! + 2𝑥" + 3𝑥#
2つの列ベクトル𝒂, 𝒃を𝒂𝒃!
の順に掛けると、⾏
列 (𝐴 = 𝒂𝒃!
) になる。 𝒂, 𝒃どちらも0でなければ、
この⾏列はRankが1になることが分かる。(各
⾏は定数倍であり、各列も定数倍である)
2つの列ベクトルの内積(𝒂 ) 𝒃)は⾏列形
式では、𝒂!
𝒃 と表現され、1つのスカ
ラーになる。
v2
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 10
= = +
⾏列とベクトルの積 – 2つ
𝐴 の⾏ベクトルと列ベクトルの積
(内積)からなる1つの列ベクトル
𝐴 の列ベクトルの線形結合
𝐴𝒙 =
1 2
3 4
5 6
𝑥!
𝑥"
=
(𝑥!+2𝑥")
(3𝑥! + 4𝑥")
(5𝑥! + 6𝑥")
𝐴𝒙 =
1 2
3 4
5 6
𝑥!
𝑥"
= 𝑥!
1
3
5
+ 𝑥"
2
4
6
最初に左を覚えるだろう。しかし、右の⾒⽅ができるようになると、
𝐴𝒙 が𝐴の列ベクトルの線形結合、すなわち、 𝐴の列ベクトル空間 𝐂(𝐴)、
さらに、 𝐴𝒙 = 0 の解がAの零空間 𝐍(𝐴)と読めるようになる。
Mv
1
Mv
2
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 11
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 12
⾏列と⾏列の積 – 4つ
=
1 2
3 4
5 6
𝑥" 𝑦"
𝑥# 𝑦#
=
(𝑥"+2𝑥#) (𝑦"+2𝑦#)
(3𝑥"+4𝑥#) (3𝑦"+4𝑦#)
(5𝑥"+6𝑥#) (5𝑦"+6𝑦#)
1 2
3 4
5 6
𝑥" 𝑦"
𝑥# 𝑦#
= 𝐴 𝒙 𝒚 = 𝐴𝒙 𝐴𝒚
= =
結果の各列 𝐴𝒙, 𝐴𝒚 は、それぞれ𝐴 の列ベクトルの線形結合
結果の各要素は、⾏ベクトルと列ベクトルの内積
MM
1
MM
2
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 13
⾏列と⾏列の積 – 4つ
= +
= =
1 2
3 4
5 6
𝑏"" 𝑏"#
𝑏#" 𝑏##
= 𝒂𝟏 𝒂𝟐
𝒃𝟏
∗
𝒃𝟐
∗ = 𝒂𝟏𝒃𝟏
∗
+ 𝒂𝟐𝒃𝟐
∗
=
1
3
5
𝑏"" 𝑏"# +
2
4
6
𝑏#" 𝑏## =
𝑏"" 𝑏"#
3𝑏"" 3𝑏"#
5𝑏"" 5𝑏"#
+
2𝑏#" 2𝑏##
4𝑏#" 4𝑏##
6𝑏#" 6𝑏##
1 2
3 4
5 6
𝑥" 𝑦"
𝑥# 𝑦#
=
𝒂𝟏
∗
𝒂𝟐
∗
𝒂𝟑
∗
𝑋 =
𝒂𝟏
∗
𝑋
𝒂𝟐
∗
𝑋
𝒂𝟑
∗
𝑋
⾏列の積は、rank 1の⾏列の和に分解される。
結果の各⾏は、⾏ベクトルの線形結合
MM
3
MM
4
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 14
便利な応⽤パターン – 3つ
2 3
=
1 2 3
1 1
=
2
1
+
3
+
2
=
2
1
+
3
+
3
=
2
1
+
3
+
MM
2
Mv
2
右からの操作は、列に作⽤する。
この表現は、右の3つの線形結合を
1つの⾏列表現で表したものだとも
⾔える。
P1
using
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 15
1
2
3
= 1
2
3
1 = +
1 2 3
+
2 = +
1 2 3
+
3 = +
1 2 3
+
MM
3
左からの操作は、⾏に作⽤する。
この表現は、右の3つの線形結合を
1つの⾏列表現で表したものだとも
⾔える。
P2 using
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 16
便利な応⽤パターン – 3つ
= =
𝐴𝐷 = 𝒂𝟏 𝒂𝟐 𝒂𝟑
𝑑!
𝑑"
𝑑#
= 𝑑!𝒂𝟏 𝑑"𝒂𝟐 𝑑"𝒂𝟐 𝐷𝐵 =
𝑑!
𝑑"
𝑑#
𝒃!
∗
𝒃!
∗
𝒃!
∗
=
𝑑!𝒃!
∗
𝑑!𝒃!
∗
𝑑!𝒃!
∗
対⾓⾏列を右から掛けると各列がスカラー倍 対⾓⾏列を左から掛けると各⾏がスカラー倍
これらを⽬に焼き付けると、さらに、、、、
P1ʼ P2ʼ
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 17
便利な応⽤パターン – 3つ
スカラー倍された列ベクトルの線形結合(ベクトル漸化式やベクトル線形微分⽅程式で活⽤)
=
𝑿𝑫𝒄 = 𝒙𝟏 𝒙𝟐 𝒙𝟑
𝑑!
𝑑"
𝑑#
𝑐!
𝑐"
𝑐#
= 𝑐!𝑑!𝒙𝟏 + 𝑐"𝑑"𝒙𝟐+ 𝑐#𝑑#𝒙𝟑
+ +
P3
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 18
便利な応⽤パターン – 3つ
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 19
微分⽅程式、漸化式の例
P3
𝑋 𝑒*+, Λ, 𝒄 𝒙𝟏 𝒙𝟐 𝒙𝟑
= + +
𝑈𝛴𝑉- = 𝒖𝟏 𝒖𝟐 𝒖𝟑
𝜎!
𝜎"
𝜎#
𝒗!
-
𝒗"
-
𝒗#
-
= 𝜎!𝒖!𝒗!
- + 𝜎"𝒖"𝒗"
-+ 𝜎#𝒖#𝒗#
-
rank 1⾏列の和 (SVDや対称⾏列のスペクトル分解で活⽤)
P4
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 20
便利な応⽤パターン – 3つ
𝐴 = 𝐶𝑅
𝐴 = 𝐿𝑈
𝐴 = 𝑄𝑅
𝑆 = 𝑄Λ𝑄!
𝐴 = 𝑈Σ𝑉!
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 21
独⽴列⾏列と⾏簡約⾏列の積
(⾏ランク=列ランクを⽰す)
LU分解=ガウスの消去法
QR分解=Gram-Schmidtの直⾏化
対称⾏列の固有値分解
どんな⻑⽅⾏列にも使える
特異値分解
⾏列の有名分解 – 5つ
𝐴 = 𝐶𝑅
𝐴の列ベクトルを左から順に⾒て、独⽴なもののみ選び出していく。1,2列⽬は⽣き残り、3列⽬は1列⽬+2列
⽬なので捨てる。残った2つの列ベクトルCを使って𝐴 を復元すると、𝑅には階段⾏列が現れる。
これを、よく⾒て、⼆つの表現で表すと…
⻑⽅⾏列𝐴の⾏ランクと、 𝐴の列ランクが等しいことを最も直感的に⽰す分解。
Cは𝐴の線形独⽴な列ベクトル。 𝑅は⾏簡約階段⾏列(row reduced echelon form)となる。
1 2 3
2 3 5
=
1 2
2 3
1 0 1
0 1 1
|
𝒂𝟏
|
|
𝒂𝟐
|
|
𝒂𝟑
|
=
|
𝒄𝟏
|
|
𝒄𝟐
|
1 0 1
0 1 1
𝒂𝟏 = 𝒄𝟏, 𝒂𝟐= 𝒄𝟐, 𝒂𝟑 = 𝒄𝟏 + 𝒄𝟐
−𝒂"
∗
−
−𝒂#
∗
−
=
1 2
2 3
−𝒓"
∗
−
−𝒓#
∗
−
𝒂"
∗
= 𝒓"
∗
+ 2𝒓#
∗
, 𝒂#
∗
= 2𝒓"
∗
+ 3𝒓#
∗
= 2
1 = 1 + 2 1 + 2 1 + 2
すべての列ベクトルはc1,c2の線形結合。すなわち、列ランク=dim C(𝐴)=2。
= +
1
2
1 2
1 2
+
=
すべての⾏ベクトルはr1,r2の線形結合。すなわち、⾏ランク=dim C(𝐴!
)=2。
𝐴 = 𝐶𝑅
P1
P2
using
using
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 22
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 23
= 2
1 = 1 + 2 1 + 2 1 + 2
1 2 3
2 3 5
= +
1
2
1 2
1 2
+
=
𝐴 =
|
𝒍𝟏
|
−𝒖!
∗
− +
0 0 0
0
0
𝐴"
=
|
𝒍𝟏
|
−𝒖!
∗
− +
|
𝒍𝟐
|
−𝒖"
∗
− +
0 0 0
0 0 0
0 0 𝐴#
= 𝐿𝑈
𝐴 = 𝐿𝑈
𝐴の⾏1ベクトルと列1ベクトルでできる rank 1⾏列を取り出し、サイズが1つ減った⾏列を𝐴# とする。
この操作を再帰的に繰り返して、rank 1 の和に分解する。
= + +
𝐿𝑈 を逆向きに計算して𝐴 に戻すのは容易。
MM
4
ガウスの消去法は、⾏基本変形をAの左から掛けていくが、その逆⾏列が 𝐿である。
using
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 24
=
= + +
𝐿 𝑈
𝐴
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 25
=
= + +
𝐿 𝑈
𝐴
1 2 4
2
1
5
5
1
3
=
=
𝐴 = 𝑄𝑅
𝐴の各列ベクトルを、Gram-Schmidtの直⾏化によって𝑄 の列ベクトルに直⾏化する。
その際の係数を逆にすることで、𝑅に上三⾓⾏列が作られる。
Gram-Schmidt の直⾏化。
2 3
1
|
𝒂𝟏
|
|
𝒂𝟐
|
|
𝒂𝟑
|
=
|
𝒒𝟏
|
|
𝒒𝟐
|
|
𝒒𝟑
|
𝑟"" 𝑟"# 𝑟"(
𝑟## 𝑟#(
𝑟((
3
1
+
1 2
+
1 2
+
𝒂𝟏 = 𝑟""𝒒𝟏
𝒂𝟐 = 𝑟"#𝒒𝟏 + 𝑟##𝒒𝟐
𝒂𝟐 = 𝑟"(𝒒𝟏 + 𝑟#(𝒒𝟐 + 𝑟((𝒒𝟑
𝐴 = 𝑄𝑅
P1
using
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 26
𝑄 𝑅
𝐴 𝒂𝟏 𝒂𝟐 𝒂𝟑
𝑆 = 𝑄𝛬𝑄-=
|
𝒒𝟏
|
|
𝒒𝟐
|
|
𝒒𝟑
|
𝜆!
𝜆"
𝜆#
−𝒒!
-
−
−𝒒"
- −
−𝒒#
-
−
=𝜆!
|
𝒒𝟏
|
−𝒒!
- − + 𝜆"
|
𝒒𝟐
|
−𝒒"
- − + 𝜆#
|
𝒒𝟑
|
−𝒒#
- −
𝑆 = 𝑄𝛬𝑄*
対称⾏列𝑆は、直⾏⾏列𝑄によって固有値の対⾓⾏列𝛬に対⾓化される。
さらに、これを rank 1 の射影⾏列の和に分解できる。(スペクトル分解)
= 𝜆!𝑃! + 𝜆"𝑃" + 𝜆#𝑃#
対称⾏列𝑆の固有値分解。固有値はすべて実数であり、固有ベクトルは必ず互いに直⾏したものが取れる。
2 3
1
= + +
= 1
2
3
1
1
2
2
3
3 P4
using
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 27
𝑄 𝛬
𝑆 𝑄. 𝜆!𝒒𝟏𝒒!
.
𝜆"𝒒𝟐𝒒"
.
𝜆#𝒒𝟑𝒒#
.
𝑆 = 𝑆-
𝑄-𝑄 = 𝑃! +𝑃" + 𝑃# = 𝐼
𝑃!𝑃" = 𝑃"𝑃# = 𝑃#𝑃! = 𝑂
𝐴 = 𝑈Σ𝑉+
𝐴の⾏空間ℝ)
の正規直交基底として𝑉、列空間 ℝ*
の正規直交規定として𝑈をそれぞれうまく取ると、対
⾓化される。これを特異値分解という。さらに、これを rank 1 ⾏列の和に分解できる。
𝐴が⼀般の⻑⽅⾏列の場合でも、特異値分解は必ず可能。
= +
=
1
1
2
2
2 3
1
1
2
P4
using
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 28
𝑈 Σ
𝐴 𝑉- 𝜎! 𝒖𝟏𝒗!
-
𝜎" 𝒖𝟐𝒗"
-
𝑈𝑈- = 𝐼/
𝑉𝑉- = 𝐼,
𝐴 = 𝑈Σ𝑉-=
|
𝒖𝟏
|
|
𝒖𝟐
|
|
𝒖𝟑
|
𝜎!
𝜎"
−𝒗!
- −
−𝒗"
- −
=𝜎!
|
𝒖𝟏
|
− 𝒗!
-
− + 𝜎"
|
𝒖𝟐
|
− 𝒗"
-
−
= 𝜎!𝒖𝟏𝒗!
- + 𝜎"𝒖𝟐𝒗"
-
SVDの応⽤からの理解︓ eigenface
Washington ⼤学の Steve Brunton 先⽣の YouTube チャネル
にて、120回以上の動画で詳しくこの本の中について解説されて
いる。その中の、eigenface の回をご紹介。
Databookuw.com
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang
Eigenfaces – Yale B Dataset
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 30
256値×32K 画素×64枚× 36⼈、から、特異値ベクトルを抽出
⾏列の2つの意味(1.写像)
𝐴 ∈ 𝑀 𝑚×𝑛, ℝ m⾏n列の実数要素の⾏列
1. ℝ!→ ℝ" の線形写像と⾒る
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 31
ℝ" ℝ#
→
𝑥
𝐴
𝐴𝑥
𝑥∈ℝ" n次元列ベクトル
𝐴𝑥∈ℝ# m次元列ベクトル
𝐶 A = 𝐴𝑥 𝑥∈ℝ"
} Aの列空間⊂ ℝ#
𝑁 A = 𝑥 𝑥∈ℝ", 𝐴𝑥 = 0} Aの零空間⊂ ℝ"
= +
𝐴 の列ベクトルの線形結合
𝑨𝒙 =
1 0
2 1
3 1
𝑥!
𝑥"
= 𝑥!
1
2
3
+ 𝑥"
0
1
1
Mv
2
rank 𝐴 = dim 𝐶(𝐴)
m x n の時、 ℝ%
→ ℝ&
nが⼊⼒m
が出⼒であることに注意。
⾏列の2つの意味(2.データ)
2. ℝ" のデータセットが𝑛列と⾒る。
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 32
𝑎$, 𝑎%, … , 𝑎" ∈ ℝ# m次元列ベクトルのデータ
𝑢$, 𝑢%, … , 𝑢# ∈ ℝ# m次元列ベクトルの底
|
𝒂𝟏
|
|
𝒂𝟐
|
|
𝒂𝟑
|
=
|
𝒆𝟏
|
|
𝒆𝟐
|
|
𝒆𝟑
|
1 0 1
2
3
1
1
3
4
2 3
=
1
2 3
1
1
=
2
1
+
3
+
2
=
2
1
+
3
+
3
=
2
1
+
3
+
P1
𝒂𝟏 = 𝒖𝟏, 𝒂𝟐 = 𝒖𝟐, 𝒂𝟐 = 𝒖𝟏 + 𝒖𝟐
|
𝒂𝟏
|
|
𝒂𝟐
|
|
𝒂𝟑
|
=
|
𝒖𝟏
|
|
𝒖𝟐
|
|
𝒖𝟑
|
1 0 1
0
0
1
0
1
0
新しい基底(u1,u2,u3)の線形結合として各列を表す
通常の基底(e1,e2,e3)の線形結合として各列を表す 基底
この基底での「座標」
もしくは「成分」が
縦に並ぶ。
各データベクトル
𝑨 =
1 0 1
2
3
1
1
3
4
フーリエ変換等でもデータ圧縮可能
だが、SVDではデータ駆動で(デー
タ全体を⾒てから)有効な底を決め
る。
固有値/固有ベクトル(復習)
𝐴 ∈ 𝑀 𝑛×𝑛, ℝ n⾏n列の実数要素の正⽅⾏列
1. ℝ!→ ℝ! の線形写像と⾒る
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 33
ℝ" ℝ"
→
𝑥
𝐴
𝐴𝑥
⽅向を変えないベクトルがある。
それらを基底とする(座標は⼲渉しないで定数倍になる)。
𝐴𝒑$ = 𝜆$𝒑$
𝐴𝒑% = 𝜆%𝒑%
𝐴𝒑& = 𝜆&𝒑&
𝐴𝑥 = 𝜆𝑥
𝐴𝑃 = 𝑃𝛬, 𝐴 = 𝑃𝛬𝑃2!
𝑨
|
𝒑𝟏
|
|
𝒑𝟐
|
|
𝒑𝟑
|
=
|
𝒑𝟏
|
|
𝒑𝟐
|
|
𝒑𝟑
|
𝜆!
𝜆"
𝜆#
1
= 1
1
2
= 2
2
3
= 3
3
1
2
3
2 3
1
2 3
1
=
※必ずn本取れるとは限らない。
対称⾏列なら正規直交なPが必ず取れ、λは実数。
特異値/特異ベクトル
𝐴 ∈ 𝑀 𝑚×𝑛, ℝ m⾏n列の実数要素の⻑⽅⾏列
1. ℝ!→ ℝ" の線形写像と⾒る
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 34
ℝ" ℝ#
→
𝑥
𝐴
𝐴𝑥
別の正規直⾏ベクトルを基底とする。
座標は⼲渉しないで定数倍(⾮負の実数)になる。
𝐴𝒗$ = 𝜎$𝒖$
𝐴𝒗% = 𝜎%𝒖%
𝐴𝒗& = 𝜎&𝒖&
𝐴𝑉 = 𝑈Σ
𝐴 = 𝑈Σ𝑉!
1
= 1
1
2
= 2
2
3
= 3
3
1
2
3
2 3
1
2 3
1
=
※必ず分解でき、⼀意になる。
1
2
3
2 3
1
= 1
2
3
特異値/特異ベクトル
1. 𝑛個の ℝ" のデータセットと⾒る。
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 35
2 3
1
2 3
1 1
=
2
1
+
3
+
2
=
2
1
+
3
+
3
=
2
1
+
3
+
新基底
各データベクトル
(各⾃の顔データ)
2 3
1
=
=
新基底
(eigen face)
𝐴 = 𝑈Σ𝑉"
𝐴 =
|
𝒖𝟏
|
|
𝒖𝟐
|
|
𝒖𝟑
|
𝜎&
𝜎'
𝜎(
−𝒗&
"
−
−𝒗'
" −
−𝒗(
"
−
𝐴 𝑉'
𝑈 Σ (Σ𝑉')
𝑈
=
=
A	の各列(face)は、新基底(eigenface)の線形結合。
A	全体の中での信号の強さが特異値。
データごとの
Mixture(Vの⾏)
信号の強さ
(特異値)
新基底での座標
(各⾃の顔の成分)
新基底での座標
(各⾃の顔の成分)
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 36
⼿で分解するには、 𝐴'𝐴(どんな𝐴でも対称⾏列となる)を使う。
𝐴 = 𝑈Σ𝑉"
𝐴"𝐴 = (𝑈Σ𝑉")"𝑈Σ𝑉" = 𝑉Σ'𝑉"
となり、 𝐴"𝐴(対称⾏列)の対⾓化(固有値)を求めるのと同じ問題に帰着。
1. 𝐴"𝐴 を計算。
2. それを対⾓化、すなわち固有値𝜎'と固有ベクトル 𝒗 をn個求める。
3. それらが、 Σ', 𝑉 となる。
4. Σと𝑉が求まったら、 𝐴𝒗 = 𝜎𝒖 より、𝒗 に対応する 𝒖求めて、 𝑼とする。
これは⼿計算⽤で、通常、コンピュータの数値演算は全く違う
⽅法(シフト付きQRなど) をとる。
特異値/特異ベクトル
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 37
直感で SVD 出来ますか︖
1. 𝐴 = 3
2. 𝐴 =
1
2
3. 𝐴 =
1 3
2 6
直感 or 計算で SVD 出来ますか︖
ポイント
𝐴 = 𝑈Σ𝑉!
単位直⾏⾏列
(⻑さ・⾓度を変えない)
(回転と捉えて良い)
対⾓⾏列
(向きを変えない)
(スケールと捉えて良い)
𝑈
𝑉
𝑈の次元は?
𝑉の次元は?
ℝ" ℝ#
𝐴
⾏空間 列空間
→
= 1 3 1
=
1
5
1
2
5 1
=
1
5
1 −2
2 1
5
0
1
特異値/特異ベクトル
Eigenfaces – Yale B Dataset
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 38
256値×32K 画素×64枚× 36⼈、から、特異値ベクトルを抽出
最初の 64 eigenfaces(ちょっと怖い…)
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 39
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 40
顔データを元よりも少数
次元の基底によって復元
する。
基底は、U を特異値の⼩
さい⽅を削除ししまった
近似。
このU平⾯に新しい顔を
射影し、その座標(少数)
をαという。このαを使っ
て、新しい顔を表現する。
(データ圧縮)
顔を次元を順次増
やして復元。
効率は良くないが、
⽝も表現できるよ。
(だいぶ怖い)
参照⽂献と
謝辞
• Linear Algebra for Everyone
(⽇本語 来年)
http://math.mit.edu/everyone/
• MIT OpenCourseWare 18.06
http://web.mit.edu/18.06/www/vi
deos.shtml
• A 2020 Vision of Linear Algebra
https://ocw.mit.edu/resources/res
-18-010-a-2020-vision-of-linear-
algebra-spring-2020/
• マトリックスワールド
https://anagileway.com/2020/09/
29/matrix-world-in-linear-algebra-
for-everyone/
• 4つの部分空間 Tシャツ
https://anagileway.com/2020/06/
04/prof-gilbert-strang-linear-
algebra/
This work is inspired by Prof. Strangʼs
books and lecture videos. I deeply
appreciate his work, passion and
personality.
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang
41
By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 42
Tシャツ作った!
Thank you for
reading!
Any comments or feedbacks are welcome to:
Kenji Hiranabe (hiranabe@gmail.com)
=
43

Más contenido relacionado

La actualidad más candente

最適輸送の計算アルゴリズムの研究動向
最適輸送の計算アルゴリズムの研究動向最適輸送の計算アルゴリズムの研究動向
最適輸送の計算アルゴリズムの研究動向ohken
 
ブラックボックス最適化とその応用
ブラックボックス最適化とその応用ブラックボックス最適化とその応用
ブラックボックス最適化とその応用gree_tech
 
MIRU2016 チュートリアル
MIRU2016 チュートリアルMIRU2016 チュートリアル
MIRU2016 チュートリアルShunsuke Ono
 
強化学習その1
強化学習その1強化学習その1
強化学習その1nishio
 
[DL輪読会]Deep Learning 第15章 表現学習
[DL輪読会]Deep Learning 第15章 表現学習[DL輪読会]Deep Learning 第15章 表現学習
[DL輪読会]Deep Learning 第15章 表現学習Deep Learning JP
 
クラシックな機械学習入門:付録:よく使う線形代数の公式
クラシックな機械学習入門:付録:よく使う線形代数の公式クラシックな機械学習入門:付録:よく使う線形代数の公式
クラシックな機械学習入門:付録:よく使う線形代数の公式Hiroshi Nakagawa
 
機械学習モデルのハイパパラメータ最適化
機械学習モデルのハイパパラメータ最適化機械学習モデルのハイパパラメータ最適化
機械学習モデルのハイパパラメータ最適化gree_tech
 
スパースモデリング入門
スパースモデリング入門スパースモデリング入門
スパースモデリング入門Hideo Terada
 
機械学習におけるオンライン確率的最適化の理論
機械学習におけるオンライン確率的最適化の理論機械学習におけるオンライン確率的最適化の理論
機械学習におけるオンライン確率的最適化の理論Taiji Suzuki
 
[DL輪読会]Flow-based Deep Generative Models
[DL輪読会]Flow-based Deep Generative Models[DL輪読会]Flow-based Deep Generative Models
[DL輪読会]Flow-based Deep Generative ModelsDeep Learning JP
 
Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)Yoshitaka Ushiku
 
SSII2021 [OS2-01] 転移学習の基礎:異なるタスクの知識を利用するための機械学習の方法
SSII2021 [OS2-01] 転移学習の基礎:異なるタスクの知識を利用するための機械学習の方法SSII2021 [OS2-01] 転移学習の基礎:異なるタスクの知識を利用するための機械学習の方法
SSII2021 [OS2-01] 転移学習の基礎:異なるタスクの知識を利用するための機械学習の方法SSII
 
グラフィカル Lasso を用いた異常検知
グラフィカル Lasso を用いた異常検知グラフィカル Lasso を用いた異常検知
グラフィカル Lasso を用いた異常検知Yuya Takashina
 
ベータ分布の謎に迫る
ベータ分布の謎に迫るベータ分布の謎に迫る
ベータ分布の謎に迫るKen'ichi Matsui
 
Deeplearning輪読会
Deeplearning輪読会Deeplearning輪読会
Deeplearning輪読会正志 坪坂
 
2014 3 13(テンソル分解の基礎)
2014 3 13(テンソル分解の基礎)2014 3 13(テンソル分解の基礎)
2014 3 13(テンソル分解の基礎)Tatsuya Yokota
 

La actualidad más candente (20)

最適輸送の計算アルゴリズムの研究動向
最適輸送の計算アルゴリズムの研究動向最適輸送の計算アルゴリズムの研究動向
最適輸送の計算アルゴリズムの研究動向
 
正準相関分析
正準相関分析正準相関分析
正準相関分析
 
ブラックボックス最適化とその応用
ブラックボックス最適化とその応用ブラックボックス最適化とその応用
ブラックボックス最適化とその応用
 
MIRU2016 チュートリアル
MIRU2016 チュートリアルMIRU2016 チュートリアル
MIRU2016 チュートリアル
 
強化学習その1
強化学習その1強化学習その1
強化学習その1
 
[DL輪読会]Deep Learning 第15章 表現学習
[DL輪読会]Deep Learning 第15章 表現学習[DL輪読会]Deep Learning 第15章 表現学習
[DL輪読会]Deep Learning 第15章 表現学習
 
クラシックな機械学習入門:付録:よく使う線形代数の公式
クラシックな機械学習入門:付録:よく使う線形代数の公式クラシックな機械学習入門:付録:よく使う線形代数の公式
クラシックな機械学習入門:付録:よく使う線形代数の公式
 
一般化線形モデル (GLM) & 一般化加法モデル(GAM)
一般化線形モデル (GLM) & 一般化加法モデル(GAM) 一般化線形モデル (GLM) & 一般化加法モデル(GAM)
一般化線形モデル (GLM) & 一般化加法モデル(GAM)
 
階層ベイズとWAIC
階層ベイズとWAIC階層ベイズとWAIC
階層ベイズとWAIC
 
機械学習モデルのハイパパラメータ最適化
機械学習モデルのハイパパラメータ最適化機械学習モデルのハイパパラメータ最適化
機械学習モデルのハイパパラメータ最適化
 
スパースモデリング入門
スパースモデリング入門スパースモデリング入門
スパースモデリング入門
 
ELBO型VAEのダメなところ
ELBO型VAEのダメなところELBO型VAEのダメなところ
ELBO型VAEのダメなところ
 
機械学習におけるオンライン確率的最適化の理論
機械学習におけるオンライン確率的最適化の理論機械学習におけるオンライン確率的最適化の理論
機械学習におけるオンライン確率的最適化の理論
 
[DL輪読会]Flow-based Deep Generative Models
[DL輪読会]Flow-based Deep Generative Models[DL輪読会]Flow-based Deep Generative Models
[DL輪読会]Flow-based Deep Generative Models
 
Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)Curriculum Learning (関東CV勉強会)
Curriculum Learning (関東CV勉強会)
 
SSII2021 [OS2-01] 転移学習の基礎:異なるタスクの知識を利用するための機械学習の方法
SSII2021 [OS2-01] 転移学習の基礎:異なるタスクの知識を利用するための機械学習の方法SSII2021 [OS2-01] 転移学習の基礎:異なるタスクの知識を利用するための機械学習の方法
SSII2021 [OS2-01] 転移学習の基礎:異なるタスクの知識を利用するための機械学習の方法
 
グラフィカル Lasso を用いた異常検知
グラフィカル Lasso を用いた異常検知グラフィカル Lasso を用いた異常検知
グラフィカル Lasso を用いた異常検知
 
ベータ分布の謎に迫る
ベータ分布の謎に迫るベータ分布の謎に迫る
ベータ分布の謎に迫る
 
Deeplearning輪読会
Deeplearning輪読会Deeplearning輪読会
Deeplearning輪読会
 
2014 3 13(テンソル分解の基礎)
2014 3 13(テンソル分解の基礎)2014 3 13(テンソル分解の基礎)
2014 3 13(テンソル分解の基礎)
 

Similar a Graphic Notes on Linear Algebra and Data Science

Graphic Notes on Introduction to Linear Algebra
Graphic Notes on Introduction to Linear AlgebraGraphic Notes on Introduction to Linear Algebra
Graphic Notes on Introduction to Linear AlgebraKenji Hiranabe
 
行列(人間科学のための基礎数学)
行列(人間科学のための基礎数学)行列(人間科学のための基礎数学)
行列(人間科学のための基礎数学)Masahiro Okano
 
chapter1_part2.pdf
chapter1_part2.pdfchapter1_part2.pdf
chapter1_part2.pdfAliEb2
 
Examples of Functions and Their Graphs.pptx
Examples of Functions and Their Graphs.pptxExamples of Functions and Their Graphs.pptx
Examples of Functions and Their Graphs.pptxJimmyAbalos1
 
Parallel Line Properties
Parallel Line PropertiesParallel Line Properties
Parallel Line PropertiesFidelfo Moral
 
Rabbit challenge 1_math
Rabbit challenge 1_mathRabbit challenge 1_math
Rabbit challenge 1_mathTOMMYLINK1
 
1539 graphs linear equations and functions
1539 graphs linear equations and functions1539 graphs linear equations and functions
1539 graphs linear equations and functionsDr Fereidoun Dejahang
 
Get the facts, jack!
Get the facts, jack!Get the facts, jack!
Get the facts, jack!sgibson1626
 
February 17, 2015
February 17, 2015February 17, 2015
February 17, 2015khyps13
 
Lecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptxLecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptxSunny432360
 
Applied mathematics
Applied mathematicsApplied mathematics
Applied mathematicsssuserada5be
 
Algebra equations & inequalities
Algebra equations & inequalitiesAlgebra equations & inequalities
Algebra equations & inequalitiesOurutopy
 
CLASS 9 LINEAR EQUATIONS IN TWO VARIABLES PPT
CLASS 9 LINEAR EQUATIONS IN TWO VARIABLES PPTCLASS 9 LINEAR EQUATIONS IN TWO VARIABLES PPT
CLASS 9 LINEAR EQUATIONS IN TWO VARIABLES PPT05092000
 

Similar a Graphic Notes on Linear Algebra and Data Science (20)

Graphic Notes on Introduction to Linear Algebra
Graphic Notes on Introduction to Linear AlgebraGraphic Notes on Introduction to Linear Algebra
Graphic Notes on Introduction to Linear Algebra
 
行列(人間科学のための基礎数学)
行列(人間科学のための基礎数学)行列(人間科学のための基礎数学)
行列(人間科学のための基礎数学)
 
MT102 Лекц 16
MT102 Лекц 16MT102 Лекц 16
MT102 Лекц 16
 
Matrix algebra
Matrix algebraMatrix algebra
Matrix algebra
 
chapter1_part2.pdf
chapter1_part2.pdfchapter1_part2.pdf
chapter1_part2.pdf
 
Examples of Functions and Their Graphs.pptx
Examples of Functions and Their Graphs.pptxExamples of Functions and Their Graphs.pptx
Examples of Functions and Their Graphs.pptx
 
Parallel Line Properties
Parallel Line PropertiesParallel Line Properties
Parallel Line Properties
 
Rabbit challenge 1_math
Rabbit challenge 1_mathRabbit challenge 1_math
Rabbit challenge 1_math
 
MT102 Лекц 15
MT102 Лекц 15MT102 Лекц 15
MT102 Лекц 15
 
1539 graphs linear equations and functions
1539 graphs linear equations and functions1539 graphs linear equations and functions
1539 graphs linear equations and functions
 
Get the facts, jack!
Get the facts, jack!Get the facts, jack!
Get the facts, jack!
 
February 17, 2015
February 17, 2015February 17, 2015
February 17, 2015
 
Lecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptxLecture_9_LA_Review.pptx
Lecture_9_LA_Review.pptx
 
Applied mathematics
Applied mathematicsApplied mathematics
Applied mathematics
 
Algebra equations & inequalities
Algebra equations & inequalitiesAlgebra equations & inequalities
Algebra equations & inequalities
 
Linear relations
   Linear relations   Linear relations
Linear relations
 
Differentiation
Differentiation Differentiation
Differentiation
 
CLASS 9 LINEAR EQUATIONS IN TWO VARIABLES PPT
CLASS 9 LINEAR EQUATIONS IN TWO VARIABLES PPTCLASS 9 LINEAR EQUATIONS IN TWO VARIABLES PPT
CLASS 9 LINEAR EQUATIONS IN TWO VARIABLES PPT
 
Maths
MathsMaths
Maths
 
Lecture_1_matrix_operations.pdf
Lecture_1_matrix_operations.pdfLecture_1_matrix_operations.pdf
Lecture_1_matrix_operations.pdf
 

Más de Kenji Hiranabe

effective ba for online communication
effective ba for online communication effective ba for online communication
effective ba for online communication Kenji Hiranabe
 
線形代数の視覚的理解 V1.1-Gストラング勉強会
線形代数の視覚的理解 V1.1-Gストラング勉強会線形代数の視覚的理解 V1.1-Gストラング勉強会
線形代数の視覚的理解 V1.1-Gストラング勉強会Kenji Hiranabe
 
Math in Machine Learning / PCA and SVD with Applications
Math in Machine Learning / PCA and SVD with ApplicationsMath in Machine Learning / PCA and SVD with Applications
Math in Machine Learning / PCA and SVD with ApplicationsKenji Hiranabe
 
Scrum-Fest-Sapporo-2021-Keynote-Our-Journey
Scrum-Fest-Sapporo-2021-Keynote-Our-JourneyScrum-Fest-Sapporo-2021-Keynote-Our-Journey
Scrum-Fest-Sapporo-2021-Keynote-Our-JourneyKenji Hiranabe
 
Appreciating Your Way to XP
Appreciating Your Way to XPAppreciating Your Way to XP
Appreciating Your Way to XPKenji Hiranabe
 
Digital Business and Agile
Digital Business and AgileDigital Business and Agile
Digital Business and AgileKenji Hiranabe
 
線形代数の視覚的理解のためのノート
線形代数の視覚的理解のためのノート線形代数の視覚的理解のためのノート
線形代数の視覚的理解のためのノートKenji Hiranabe
 
with コロナ時代のアジャイルとコミュニケーション
with コロナ時代のアジャイルとコミュニケーションwith コロナ時代のアジャイルとコミュニケーション
with コロナ時代のアジャイルとコミュニケーションKenji Hiranabe
 
Agile Ba with Covid at Redmine Japan 2020
Agile Ba with Covid at Redmine Japan 2020Agile Ba with Covid at Redmine Japan 2020
Agile Ba with Covid at Redmine Japan 2020Kenji Hiranabe
 
ESM Agile Studio DX and COVID
ESM Agile Studio DX and COVIDESM Agile Studio DX and COVID
ESM Agile Studio DX and COVIDKenji Hiranabe
 
Essence position talk by hiranabe
Essence position talk by hiranabeEssence position talk by hiranabe
Essence position talk by hiranabeKenji Hiranabe
 
Agile Scrum at Knowledge Forum 2020
Agile Scrum at Knowledge Forum 2020Agile Scrum at Knowledge Forum 2020
Agile Scrum at Knowledge Forum 2020Kenji Hiranabe
 
Ba and digital here now ness
Ba and digital here now nessBa and digital here now ness
Ba and digital here now nessKenji Hiranabe
 
Modeling in the Agile Age and casual astah models
Modeling in the Agile Age and casual astah modelsModeling in the Agile Age and casual astah models
Modeling in the Agile Age and casual astah modelsKenji Hiranabe
 
Modeling in the Agile Age
Modeling in the Agile Age Modeling in the Agile Age
Modeling in the Agile Age Kenji Hiranabe
 
Agile in automotive industry
Agile in automotive industryAgile in automotive industry
Agile in automotive industryKenji Hiranabe
 
Introduction to Agile - how business and engineer team up
Introduction to Agile - how business and engineer team upIntroduction to Agile - how business and engineer team up
Introduction to Agile - how business and engineer team upKenji Hiranabe
 
5-principles-for-project-facilitation
5-principles-for-project-facilitation5-principles-for-project-facilitation
5-principles-for-project-facilitationKenji Hiranabe
 
Nonaka Scrum - The New New Product Development Game, SECI model, The US Marin...
Nonaka Scrum - The New New Product Development Game, SECI model, The US Marin...Nonaka Scrum - The New New Product Development Game, SECI model, The US Marin...
Nonaka Scrum - The New New Product Development Game, SECI model, The US Marin...Kenji Hiranabe
 

Más de Kenji Hiranabe (20)

effective ba for online communication
effective ba for online communication effective ba for online communication
effective ba for online communication
 
線形代数の視覚的理解 V1.1-Gストラング勉強会
線形代数の視覚的理解 V1.1-Gストラング勉強会線形代数の視覚的理解 V1.1-Gストラング勉強会
線形代数の視覚的理解 V1.1-Gストラング勉強会
 
Math in Machine Learning / PCA and SVD with Applications
Math in Machine Learning / PCA and SVD with ApplicationsMath in Machine Learning / PCA and SVD with Applications
Math in Machine Learning / PCA and SVD with Applications
 
Scrum-Fest-Sapporo-2021-Keynote-Our-Journey
Scrum-Fest-Sapporo-2021-Keynote-Our-JourneyScrum-Fest-Sapporo-2021-Keynote-Our-Journey
Scrum-Fest-Sapporo-2021-Keynote-Our-Journey
 
Appreciating Your Way to XP
Appreciating Your Way to XPAppreciating Your Way to XP
Appreciating Your Way to XP
 
Digital Business and Agile
Digital Business and AgileDigital Business and Agile
Digital Business and Agile
 
線形代数の視覚的理解のためのノート
線形代数の視覚的理解のためのノート線形代数の視覚的理解のためのノート
線形代数の視覚的理解のためのノート
 
with コロナ時代のアジャイルとコミュニケーション
with コロナ時代のアジャイルとコミュニケーションwith コロナ時代のアジャイルとコミュニケーション
with コロナ時代のアジャイルとコミュニケーション
 
Agile Ba with Covid at Redmine Japan 2020
Agile Ba with Covid at Redmine Japan 2020Agile Ba with Covid at Redmine Japan 2020
Agile Ba with Covid at Redmine Japan 2020
 
ESM Agile Studio DX and COVID
ESM Agile Studio DX and COVIDESM Agile Studio DX and COVID
ESM Agile Studio DX and COVID
 
Agile Ba with Covid
Agile Ba with CovidAgile Ba with Covid
Agile Ba with Covid
 
Essence position talk by hiranabe
Essence position talk by hiranabeEssence position talk by hiranabe
Essence position talk by hiranabe
 
Agile Scrum at Knowledge Forum 2020
Agile Scrum at Knowledge Forum 2020Agile Scrum at Knowledge Forum 2020
Agile Scrum at Knowledge Forum 2020
 
Ba and digital here now ness
Ba and digital here now nessBa and digital here now ness
Ba and digital here now ness
 
Modeling in the Agile Age and casual astah models
Modeling in the Agile Age and casual astah modelsModeling in the Agile Age and casual astah models
Modeling in the Agile Age and casual astah models
 
Modeling in the Agile Age
Modeling in the Agile Age Modeling in the Agile Age
Modeling in the Agile Age
 
Agile in automotive industry
Agile in automotive industryAgile in automotive industry
Agile in automotive industry
 
Introduction to Agile - how business and engineer team up
Introduction to Agile - how business and engineer team upIntroduction to Agile - how business and engineer team up
Introduction to Agile - how business and engineer team up
 
5-principles-for-project-facilitation
5-principles-for-project-facilitation5-principles-for-project-facilitation
5-principles-for-project-facilitation
 
Nonaka Scrum - The New New Product Development Game, SECI model, The US Marin...
Nonaka Scrum - The New New Product Development Game, SECI model, The US Marin...Nonaka Scrum - The New New Product Development Game, SECI model, The US Marin...
Nonaka Scrum - The New New Product Development Game, SECI model, The US Marin...
 

Último

Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPirithiRaju
 
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptxGENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptxRitchAndruAgustin
 
Observational constraints on mergers creating magnetism in massive stars
Observational constraints on mergers creating magnetism in massive starsObservational constraints on mergers creating magnetism in massive stars
Observational constraints on mergers creating magnetism in massive starsSérgio Sacani
 
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)riyaescorts54
 
basic entomology with insect anatomy and taxonomy
basic entomology with insect anatomy and taxonomybasic entomology with insect anatomy and taxonomy
basic entomology with insect anatomy and taxonomyDrAnita Sharma
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxpriyankatabhane
 
Citronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyayCitronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyayupadhyaymani499
 
Davis plaque method.pptx recombinant DNA technology
Davis plaque method.pptx recombinant DNA technologyDavis plaque method.pptx recombinant DNA technology
Davis plaque method.pptx recombinant DNA technologycaarthichand2003
 
Servosystem Theory / Cybernetic Theory by Petrovic
Servosystem Theory / Cybernetic Theory by PetrovicServosystem Theory / Cybernetic Theory by Petrovic
Servosystem Theory / Cybernetic Theory by PetrovicAditi Jain
 
PROJECTILE MOTION-Horizontal and Vertical
PROJECTILE MOTION-Horizontal and VerticalPROJECTILE MOTION-Horizontal and Vertical
PROJECTILE MOTION-Horizontal and VerticalMAESTRELLAMesa2
 
FREE NURSING BUNDLE FOR NURSES.PDF by na
FREE NURSING BUNDLE FOR NURSES.PDF by naFREE NURSING BUNDLE FOR NURSES.PDF by na
FREE NURSING BUNDLE FOR NURSES.PDF by naJASISJULIANOELYNV
 
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPirithiRaju
 
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...Universidade Federal de Sergipe - UFS
 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentationtahreemzahra82
 
Environmental Biotechnology Topic:- Microbial Biosensor
Environmental Biotechnology Topic:- Microbial BiosensorEnvironmental Biotechnology Topic:- Microbial Biosensor
Environmental Biotechnology Topic:- Microbial Biosensorsonawaneprad
 
Bioteknologi kelas 10 kumer smapsa .pptx
Bioteknologi kelas 10 kumer smapsa .pptxBioteknologi kelas 10 kumer smapsa .pptx
Bioteknologi kelas 10 kumer smapsa .pptx023NiWayanAnggiSriWa
 
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdfPests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdfPirithiRaju
 
User Guide: Magellan MX™ Weather Station
User Guide: Magellan MX™ Weather StationUser Guide: Magellan MX™ Weather Station
User Guide: Magellan MX™ Weather StationColumbia Weather Systems
 
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)Columbia Weather Systems
 
Thermodynamics ,types of system,formulae ,gibbs free energy .pptx
Thermodynamics ,types of system,formulae ,gibbs free energy .pptxThermodynamics ,types of system,formulae ,gibbs free energy .pptx
Thermodynamics ,types of system,formulae ,gibbs free energy .pptxuniversity
 

Último (20)

Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdf
 
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptxGENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
GENERAL PHYSICS 2 REFRACTION OF LIGHT SENIOR HIGH SCHOOL GENPHYS2.pptx
 
Observational constraints on mergers creating magnetism in massive stars
Observational constraints on mergers creating magnetism in massive starsObservational constraints on mergers creating magnetism in massive stars
Observational constraints on mergers creating magnetism in massive stars
 
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
 
basic entomology with insect anatomy and taxonomy
basic entomology with insect anatomy and taxonomybasic entomology with insect anatomy and taxonomy
basic entomology with insect anatomy and taxonomy
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptx
 
Citronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyayCitronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyay
 
Davis plaque method.pptx recombinant DNA technology
Davis plaque method.pptx recombinant DNA technologyDavis plaque method.pptx recombinant DNA technology
Davis plaque method.pptx recombinant DNA technology
 
Servosystem Theory / Cybernetic Theory by Petrovic
Servosystem Theory / Cybernetic Theory by PetrovicServosystem Theory / Cybernetic Theory by Petrovic
Servosystem Theory / Cybernetic Theory by Petrovic
 
PROJECTILE MOTION-Horizontal and Vertical
PROJECTILE MOTION-Horizontal and VerticalPROJECTILE MOTION-Horizontal and Vertical
PROJECTILE MOTION-Horizontal and Vertical
 
FREE NURSING BUNDLE FOR NURSES.PDF by na
FREE NURSING BUNDLE FOR NURSES.PDF by naFREE NURSING BUNDLE FOR NURSES.PDF by na
FREE NURSING BUNDLE FOR NURSES.PDF by na
 
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
 
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentation
 
Environmental Biotechnology Topic:- Microbial Biosensor
Environmental Biotechnology Topic:- Microbial BiosensorEnvironmental Biotechnology Topic:- Microbial Biosensor
Environmental Biotechnology Topic:- Microbial Biosensor
 
Bioteknologi kelas 10 kumer smapsa .pptx
Bioteknologi kelas 10 kumer smapsa .pptxBioteknologi kelas 10 kumer smapsa .pptx
Bioteknologi kelas 10 kumer smapsa .pptx
 
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdfPests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
 
User Guide: Magellan MX™ Weather Station
User Guide: Magellan MX™ Weather StationUser Guide: Magellan MX™ Weather Station
User Guide: Magellan MX™ Weather Station
 
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
User Guide: Pulsar™ Weather Station (Columbia Weather Systems)
 
Thermodynamics ,types of system,formulae ,gibbs free energy .pptx
Thermodynamics ,types of system,formulae ,gibbs free energy .pptxThermodynamics ,types of system,formulae ,gibbs free energy .pptx
Thermodynamics ,types of system,formulae ,gibbs free energy .pptx
 

Graphic Notes on Linear Algebra and Data Science

  • 2. これは何? • Gilbert Strang 著 『Linear Algebra for Everyone』 は線形代数を直感理解するのに とてもいい本です。 • 定理と証明の連鎖ではなく、マトリックス語法と例⽰で直感的な理解と実⽤的な 応⽤法を得ることができます。 • YouTube の MIT Open Courseware、 先⽣の講義プレイリストである 18.06 と 18.065 には、200万⼈の購読者がいます。(ぼくもその⼀⼈です) • この本のハイライトは、 • AB=C の4つの⾒⽅ • 基本的な4つの部分空間 • 5つのマトリックス分解 • 通常の線形代数の教科書はジョルダン標準形がクライマックスですが、この 本では、SVD です。そして、 • 機械学習を含むデータサイエンスへの⼊⾨につながっています。 • この1と2のコンセプトをグラフィック表現できないか、というアイディアです。 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 2 1 2
  • 3. この発表 のモチベ ーション • ⾏列とベクトルの掛け算には、複数の⾒⽅ があります。 • このノートは、それらを可視化し、教育⽤ コンテンツとする試みです。 • それによって ... • ⾏列とベクトルの演算を直感的に⾏えるよう になります。 • その直感を、5つの⾏列分解法、などのコンセ プトの理解につなげることができます。 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 3 最新版︓ https://github.com/kenjihiranabe/The-Art-of-Linear-Algebra/ http://math.mit.edu/everyone
  • 4. 5つの⾏列分解 𝐴 = 𝐶𝑅 𝐴 = 𝐿𝑈 𝐴 = 𝑄𝑅 𝑆 = 𝑄Λ𝑄! 𝐴 = 𝑈Σ𝑉! By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 4 独⽴列⾏列と⾏簡約⾏列の積 (⾏ランク=列ランクを⽰す) LU分解=ガウスの消去法 QR分解=Gram-Schmidtの直⾏化 対称⾏列の固有値分解 どんな⻑⽅⾏列にも使える 特異値分解
  • 5. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 5 Foreword I am happy to see Kenji Hiranabeʻs pictures of matrix operations in linear algebra ! The pictures are an excellent way to show the algebra. We can think of matrix multiplications by (row, column) dot products, but that is not all -- it is ``linear combinations” and ``rank 1 matrices" that complete the algebra and the art. I am very grateful to see the books in Japanese translation and the ideas in Kenji's pictures. -- Gilbert Strang Professor of Mathematics at MIT
  • 6. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 6 • もうすぐ⽇本語訳発売! • ⽇本語訳決定!
  • 7. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 7 先⽣の講演例:https://www.youtube.com/watch?v=MsIvs_6vC38
  • 8. ⽬次 • ⾏列の⾒⽅ – 4つ • ベクトルの積 – 2つ • ⾏列のベクトルの積 – 2つ • ⾏列と⾏列の積 – 4つ • 便利な応⽤パターン– 4つ • ⾏列の有名分解 – 5つ • 𝐶𝑅, 𝐿𝑈, 𝑄𝑅, 𝑄Λ𝑄!, 𝑈Σ𝑉! • データサイエンス応⽤で理解する SVD(今⽇だけ) By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 8
  • 9. = = = 3つの数からなる 2つの列ベクトル 2つの数からなる 3つの⾏ベクトル 6つの数 1 つの⾏列 ⾏列の⾒⽅ – 4つ 𝐴 = 𝑎!!𝑎!" 𝑎"!𝑎"" 𝑎#!𝑎#" = | 𝒂𝟏 | | 𝒂𝟐 | = −𝒂! ∗ − −𝒂" ∗ − −𝒂# ∗ − 以降、太字で列ベクトル𝒂𝟏、*を付けて⾏ベクトル𝒂" ∗ 、を表現する。 また、右肩にTをつけて転置ベクトル𝒂𝐓や転置⾏列𝑨𝐓を表現する。 𝐴 = 1 4 2 5 3 6 = 1 4 2 5 3 6 = 1 4 2 5 3 6 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 9
  • 10. = = = 内積(スカラー) Rank1の⾏列 v1 = 1 2 3 𝑥 𝑦 = 𝑥 𝑦 2𝑥 2𝑦 3𝑥 3𝑦 ベクトルの積 – 2つ 1 2 3 𝑥! 𝑥" 𝑥# = 1 2 3 , 𝑥! 𝑥" 𝑥# = 𝑥! + 2𝑥" + 3𝑥# 2つの列ベクトル𝒂, 𝒃を𝒂𝒃! の順に掛けると、⾏ 列 (𝐴 = 𝒂𝒃! ) になる。 𝒂, 𝒃どちらも0でなければ、 この⾏列はRankが1になることが分かる。(各 ⾏は定数倍であり、各列も定数倍である) 2つの列ベクトルの内積(𝒂 ) 𝒃)は⾏列形 式では、𝒂! 𝒃 と表現され、1つのスカ ラーになる。 v2 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 10
  • 11. = = + ⾏列とベクトルの積 – 2つ 𝐴 の⾏ベクトルと列ベクトルの積 (内積)からなる1つの列ベクトル 𝐴 の列ベクトルの線形結合 𝐴𝒙 = 1 2 3 4 5 6 𝑥! 𝑥" = (𝑥!+2𝑥") (3𝑥! + 4𝑥") (5𝑥! + 6𝑥") 𝐴𝒙 = 1 2 3 4 5 6 𝑥! 𝑥" = 𝑥! 1 3 5 + 𝑥" 2 4 6 最初に左を覚えるだろう。しかし、右の⾒⽅ができるようになると、 𝐴𝒙 が𝐴の列ベクトルの線形結合、すなわち、 𝐴の列ベクトル空間 𝐂(𝐴)、 さらに、 𝐴𝒙 = 0 の解がAの零空間 𝐍(𝐴)と読めるようになる。 Mv 1 Mv 2 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 11
  • 12. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 12
  • 13. ⾏列と⾏列の積 – 4つ = 1 2 3 4 5 6 𝑥" 𝑦" 𝑥# 𝑦# = (𝑥"+2𝑥#) (𝑦"+2𝑦#) (3𝑥"+4𝑥#) (3𝑦"+4𝑦#) (5𝑥"+6𝑥#) (5𝑦"+6𝑦#) 1 2 3 4 5 6 𝑥" 𝑦" 𝑥# 𝑦# = 𝐴 𝒙 𝒚 = 𝐴𝒙 𝐴𝒚 = = 結果の各列 𝐴𝒙, 𝐴𝒚 は、それぞれ𝐴 の列ベクトルの線形結合 結果の各要素は、⾏ベクトルと列ベクトルの内積 MM 1 MM 2 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 13
  • 14. ⾏列と⾏列の積 – 4つ = + = = 1 2 3 4 5 6 𝑏"" 𝑏"# 𝑏#" 𝑏## = 𝒂𝟏 𝒂𝟐 𝒃𝟏 ∗ 𝒃𝟐 ∗ = 𝒂𝟏𝒃𝟏 ∗ + 𝒂𝟐𝒃𝟐 ∗ = 1 3 5 𝑏"" 𝑏"# + 2 4 6 𝑏#" 𝑏## = 𝑏"" 𝑏"# 3𝑏"" 3𝑏"# 5𝑏"" 5𝑏"# + 2𝑏#" 2𝑏## 4𝑏#" 4𝑏## 6𝑏#" 6𝑏## 1 2 3 4 5 6 𝑥" 𝑦" 𝑥# 𝑦# = 𝒂𝟏 ∗ 𝒂𝟐 ∗ 𝒂𝟑 ∗ 𝑋 = 𝒂𝟏 ∗ 𝑋 𝒂𝟐 ∗ 𝑋 𝒂𝟑 ∗ 𝑋 ⾏列の積は、rank 1の⾏列の和に分解される。 結果の各⾏は、⾏ベクトルの線形結合 MM 3 MM 4 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 14
  • 15. 便利な応⽤パターン – 3つ 2 3 = 1 2 3 1 1 = 2 1 + 3 + 2 = 2 1 + 3 + 3 = 2 1 + 3 + MM 2 Mv 2 右からの操作は、列に作⽤する。 この表現は、右の3つの線形結合を 1つの⾏列表現で表したものだとも ⾔える。 P1 using By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 15
  • 16. 1 2 3 = 1 2 3 1 = + 1 2 3 + 2 = + 1 2 3 + 3 = + 1 2 3 + MM 3 左からの操作は、⾏に作⽤する。 この表現は、右の3つの線形結合を 1つの⾏列表現で表したものだとも ⾔える。 P2 using By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 16 便利な応⽤パターン – 3つ
  • 17. = = 𝐴𝐷 = 𝒂𝟏 𝒂𝟐 𝒂𝟑 𝑑! 𝑑" 𝑑# = 𝑑!𝒂𝟏 𝑑"𝒂𝟐 𝑑"𝒂𝟐 𝐷𝐵 = 𝑑! 𝑑" 𝑑# 𝒃! ∗ 𝒃! ∗ 𝒃! ∗ = 𝑑!𝒃! ∗ 𝑑!𝒃! ∗ 𝑑!𝒃! ∗ 対⾓⾏列を右から掛けると各列がスカラー倍 対⾓⾏列を左から掛けると各⾏がスカラー倍 これらを⽬に焼き付けると、さらに、、、、 P1ʼ P2ʼ By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 17 便利な応⽤パターン – 3つ
  • 18. スカラー倍された列ベクトルの線形結合(ベクトル漸化式やベクトル線形微分⽅程式で活⽤) = 𝑿𝑫𝒄 = 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝑑! 𝑑" 𝑑# 𝑐! 𝑐" 𝑐# = 𝑐!𝑑!𝒙𝟏 + 𝑐"𝑑"𝒙𝟐+ 𝑐#𝑑#𝒙𝟑 + + P3 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 18 便利な応⽤パターン – 3つ
  • 19. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 19 微分⽅程式、漸化式の例 P3 𝑋 𝑒*+, Λ, 𝒄 𝒙𝟏 𝒙𝟐 𝒙𝟑
  • 20. = + + 𝑈𝛴𝑉- = 𝒖𝟏 𝒖𝟐 𝒖𝟑 𝜎! 𝜎" 𝜎# 𝒗! - 𝒗" - 𝒗# - = 𝜎!𝒖!𝒗! - + 𝜎"𝒖"𝒗" -+ 𝜎#𝒖#𝒗# - rank 1⾏列の和 (SVDや対称⾏列のスペクトル分解で活⽤) P4 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 20 便利な応⽤パターン – 3つ
  • 21. 𝐴 = 𝐶𝑅 𝐴 = 𝐿𝑈 𝐴 = 𝑄𝑅 𝑆 = 𝑄Λ𝑄! 𝐴 = 𝑈Σ𝑉! By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 21 独⽴列⾏列と⾏簡約⾏列の積 (⾏ランク=列ランクを⽰す) LU分解=ガウスの消去法 QR分解=Gram-Schmidtの直⾏化 対称⾏列の固有値分解 どんな⻑⽅⾏列にも使える 特異値分解 ⾏列の有名分解 – 5つ
  • 22. 𝐴 = 𝐶𝑅 𝐴の列ベクトルを左から順に⾒て、独⽴なもののみ選び出していく。1,2列⽬は⽣き残り、3列⽬は1列⽬+2列 ⽬なので捨てる。残った2つの列ベクトルCを使って𝐴 を復元すると、𝑅には階段⾏列が現れる。 これを、よく⾒て、⼆つの表現で表すと… ⻑⽅⾏列𝐴の⾏ランクと、 𝐴の列ランクが等しいことを最も直感的に⽰す分解。 Cは𝐴の線形独⽴な列ベクトル。 𝑅は⾏簡約階段⾏列(row reduced echelon form)となる。 1 2 3 2 3 5 = 1 2 2 3 1 0 1 0 1 1 | 𝒂𝟏 | | 𝒂𝟐 | | 𝒂𝟑 | = | 𝒄𝟏 | | 𝒄𝟐 | 1 0 1 0 1 1 𝒂𝟏 = 𝒄𝟏, 𝒂𝟐= 𝒄𝟐, 𝒂𝟑 = 𝒄𝟏 + 𝒄𝟐 −𝒂" ∗ − −𝒂# ∗ − = 1 2 2 3 −𝒓" ∗ − −𝒓# ∗ − 𝒂" ∗ = 𝒓" ∗ + 2𝒓# ∗ , 𝒂# ∗ = 2𝒓" ∗ + 3𝒓# ∗ = 2 1 = 1 + 2 1 + 2 1 + 2 すべての列ベクトルはc1,c2の線形結合。すなわち、列ランク=dim C(𝐴)=2。 = + 1 2 1 2 1 2 + = すべての⾏ベクトルはr1,r2の線形結合。すなわち、⾏ランク=dim C(𝐴! )=2。 𝐴 = 𝐶𝑅 P1 P2 using using By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 22
  • 23. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 23 = 2 1 = 1 + 2 1 + 2 1 + 2 1 2 3 2 3 5 = + 1 2 1 2 1 2 + =
  • 24. 𝐴 = | 𝒍𝟏 | −𝒖! ∗ − + 0 0 0 0 0 𝐴" = | 𝒍𝟏 | −𝒖! ∗ − + | 𝒍𝟐 | −𝒖" ∗ − + 0 0 0 0 0 0 0 0 𝐴# = 𝐿𝑈 𝐴 = 𝐿𝑈 𝐴の⾏1ベクトルと列1ベクトルでできる rank 1⾏列を取り出し、サイズが1つ減った⾏列を𝐴# とする。 この操作を再帰的に繰り返して、rank 1 の和に分解する。 = + + 𝐿𝑈 を逆向きに計算して𝐴 に戻すのは容易。 MM 4 ガウスの消去法は、⾏基本変形をAの左から掛けていくが、その逆⾏列が 𝐿である。 using By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 24 = = + + 𝐿 𝑈 𝐴
  • 25. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 25 = = + + 𝐿 𝑈 𝐴 1 2 4 2 1 5 5 1 3
  • 26. = = 𝐴 = 𝑄𝑅 𝐴の各列ベクトルを、Gram-Schmidtの直⾏化によって𝑄 の列ベクトルに直⾏化する。 その際の係数を逆にすることで、𝑅に上三⾓⾏列が作られる。 Gram-Schmidt の直⾏化。 2 3 1 | 𝒂𝟏 | | 𝒂𝟐 | | 𝒂𝟑 | = | 𝒒𝟏 | | 𝒒𝟐 | | 𝒒𝟑 | 𝑟"" 𝑟"# 𝑟"( 𝑟## 𝑟#( 𝑟(( 3 1 + 1 2 + 1 2 + 𝒂𝟏 = 𝑟""𝒒𝟏 𝒂𝟐 = 𝑟"#𝒒𝟏 + 𝑟##𝒒𝟐 𝒂𝟐 = 𝑟"(𝒒𝟏 + 𝑟#(𝒒𝟐 + 𝑟((𝒒𝟑 𝐴 = 𝑄𝑅 P1 using By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 26 𝑄 𝑅 𝐴 𝒂𝟏 𝒂𝟐 𝒂𝟑
  • 27. 𝑆 = 𝑄𝛬𝑄-= | 𝒒𝟏 | | 𝒒𝟐 | | 𝒒𝟑 | 𝜆! 𝜆" 𝜆# −𝒒! - − −𝒒" - − −𝒒# - − =𝜆! | 𝒒𝟏 | −𝒒! - − + 𝜆" | 𝒒𝟐 | −𝒒" - − + 𝜆# | 𝒒𝟑 | −𝒒# - − 𝑆 = 𝑄𝛬𝑄* 対称⾏列𝑆は、直⾏⾏列𝑄によって固有値の対⾓⾏列𝛬に対⾓化される。 さらに、これを rank 1 の射影⾏列の和に分解できる。(スペクトル分解) = 𝜆!𝑃! + 𝜆"𝑃" + 𝜆#𝑃# 対称⾏列𝑆の固有値分解。固有値はすべて実数であり、固有ベクトルは必ず互いに直⾏したものが取れる。 2 3 1 = + + = 1 2 3 1 1 2 2 3 3 P4 using By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 27 𝑄 𝛬 𝑆 𝑄. 𝜆!𝒒𝟏𝒒! . 𝜆"𝒒𝟐𝒒" . 𝜆#𝒒𝟑𝒒# . 𝑆 = 𝑆- 𝑄-𝑄 = 𝑃! +𝑃" + 𝑃# = 𝐼 𝑃!𝑃" = 𝑃"𝑃# = 𝑃#𝑃! = 𝑂
  • 28. 𝐴 = 𝑈Σ𝑉+ 𝐴の⾏空間ℝ) の正規直交基底として𝑉、列空間 ℝ* の正規直交規定として𝑈をそれぞれうまく取ると、対 ⾓化される。これを特異値分解という。さらに、これを rank 1 ⾏列の和に分解できる。 𝐴が⼀般の⻑⽅⾏列の場合でも、特異値分解は必ず可能。 = + = 1 1 2 2 2 3 1 1 2 P4 using By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 28 𝑈 Σ 𝐴 𝑉- 𝜎! 𝒖𝟏𝒗! - 𝜎" 𝒖𝟐𝒗" - 𝑈𝑈- = 𝐼/ 𝑉𝑉- = 𝐼, 𝐴 = 𝑈Σ𝑉-= | 𝒖𝟏 | | 𝒖𝟐 | | 𝒖𝟑 | 𝜎! 𝜎" −𝒗! - − −𝒗" - − =𝜎! | 𝒖𝟏 | − 𝒗! - − + 𝜎" | 𝒖𝟐 | − 𝒗" - − = 𝜎!𝒖𝟏𝒗! - + 𝜎"𝒖𝟐𝒗" -
  • 29. SVDの応⽤からの理解︓ eigenface Washington ⼤学の Steve Brunton 先⽣の YouTube チャネル にて、120回以上の動画で詳しくこの本の中について解説されて いる。その中の、eigenface の回をご紹介。 Databookuw.com By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang
  • 30. Eigenfaces – Yale B Dataset By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 30 256値×32K 画素×64枚× 36⼈、から、特異値ベクトルを抽出
  • 31. ⾏列の2つの意味(1.写像) 𝐴 ∈ 𝑀 𝑚×𝑛, ℝ m⾏n列の実数要素の⾏列 1. ℝ!→ ℝ" の線形写像と⾒る By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 31 ℝ" ℝ# → 𝑥 𝐴 𝐴𝑥 𝑥∈ℝ" n次元列ベクトル 𝐴𝑥∈ℝ# m次元列ベクトル 𝐶 A = 𝐴𝑥 𝑥∈ℝ" } Aの列空間⊂ ℝ# 𝑁 A = 𝑥 𝑥∈ℝ", 𝐴𝑥 = 0} Aの零空間⊂ ℝ" = + 𝐴 の列ベクトルの線形結合 𝑨𝒙 = 1 0 2 1 3 1 𝑥! 𝑥" = 𝑥! 1 2 3 + 𝑥" 0 1 1 Mv 2 rank 𝐴 = dim 𝐶(𝐴) m x n の時、 ℝ% → ℝ& nが⼊⼒m が出⼒であることに注意。
  • 32. ⾏列の2つの意味(2.データ) 2. ℝ" のデータセットが𝑛列と⾒る。 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 32 𝑎$, 𝑎%, … , 𝑎" ∈ ℝ# m次元列ベクトルのデータ 𝑢$, 𝑢%, … , 𝑢# ∈ ℝ# m次元列ベクトルの底 | 𝒂𝟏 | | 𝒂𝟐 | | 𝒂𝟑 | = | 𝒆𝟏 | | 𝒆𝟐 | | 𝒆𝟑 | 1 0 1 2 3 1 1 3 4 2 3 = 1 2 3 1 1 = 2 1 + 3 + 2 = 2 1 + 3 + 3 = 2 1 + 3 + P1 𝒂𝟏 = 𝒖𝟏, 𝒂𝟐 = 𝒖𝟐, 𝒂𝟐 = 𝒖𝟏 + 𝒖𝟐 | 𝒂𝟏 | | 𝒂𝟐 | | 𝒂𝟑 | = | 𝒖𝟏 | | 𝒖𝟐 | | 𝒖𝟑 | 1 0 1 0 0 1 0 1 0 新しい基底(u1,u2,u3)の線形結合として各列を表す 通常の基底(e1,e2,e3)の線形結合として各列を表す 基底 この基底での「座標」 もしくは「成分」が 縦に並ぶ。 各データベクトル 𝑨 = 1 0 1 2 3 1 1 3 4 フーリエ変換等でもデータ圧縮可能 だが、SVDではデータ駆動で(デー タ全体を⾒てから)有効な底を決め る。
  • 33. 固有値/固有ベクトル(復習) 𝐴 ∈ 𝑀 𝑛×𝑛, ℝ n⾏n列の実数要素の正⽅⾏列 1. ℝ!→ ℝ! の線形写像と⾒る By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 33 ℝ" ℝ" → 𝑥 𝐴 𝐴𝑥 ⽅向を変えないベクトルがある。 それらを基底とする(座標は⼲渉しないで定数倍になる)。 𝐴𝒑$ = 𝜆$𝒑$ 𝐴𝒑% = 𝜆%𝒑% 𝐴𝒑& = 𝜆&𝒑& 𝐴𝑥 = 𝜆𝑥 𝐴𝑃 = 𝑃𝛬, 𝐴 = 𝑃𝛬𝑃2! 𝑨 | 𝒑𝟏 | | 𝒑𝟐 | | 𝒑𝟑 | = | 𝒑𝟏 | | 𝒑𝟐 | | 𝒑𝟑 | 𝜆! 𝜆" 𝜆# 1 = 1 1 2 = 2 2 3 = 3 3 1 2 3 2 3 1 2 3 1 = ※必ずn本取れるとは限らない。 対称⾏列なら正規直交なPが必ず取れ、λは実数。
  • 34. 特異値/特異ベクトル 𝐴 ∈ 𝑀 𝑚×𝑛, ℝ m⾏n列の実数要素の⻑⽅⾏列 1. ℝ!→ ℝ" の線形写像と⾒る By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 34 ℝ" ℝ# → 𝑥 𝐴 𝐴𝑥 別の正規直⾏ベクトルを基底とする。 座標は⼲渉しないで定数倍(⾮負の実数)になる。 𝐴𝒗$ = 𝜎$𝒖$ 𝐴𝒗% = 𝜎%𝒖% 𝐴𝒗& = 𝜎&𝒖& 𝐴𝑉 = 𝑈Σ 𝐴 = 𝑈Σ𝑉! 1 = 1 1 2 = 2 2 3 = 3 3 1 2 3 2 3 1 2 3 1 = ※必ず分解でき、⼀意になる。 1 2 3 2 3 1 = 1 2 3
  • 35. 特異値/特異ベクトル 1. 𝑛個の ℝ" のデータセットと⾒る。 By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 35 2 3 1 2 3 1 1 = 2 1 + 3 + 2 = 2 1 + 3 + 3 = 2 1 + 3 + 新基底 各データベクトル (各⾃の顔データ) 2 3 1 = = 新基底 (eigen face) 𝐴 = 𝑈Σ𝑉" 𝐴 = | 𝒖𝟏 | | 𝒖𝟐 | | 𝒖𝟑 | 𝜎& 𝜎' 𝜎( −𝒗& " − −𝒗' " − −𝒗( " − 𝐴 𝑉' 𝑈 Σ (Σ𝑉') 𝑈 = = A の各列(face)は、新基底(eigenface)の線形結合。 A 全体の中での信号の強さが特異値。 データごとの Mixture(Vの⾏) 信号の強さ (特異値) 新基底での座標 (各⾃の顔の成分) 新基底での座標 (各⾃の顔の成分)
  • 36. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 36 ⼿で分解するには、 𝐴'𝐴(どんな𝐴でも対称⾏列となる)を使う。 𝐴 = 𝑈Σ𝑉" 𝐴"𝐴 = (𝑈Σ𝑉")"𝑈Σ𝑉" = 𝑉Σ'𝑉" となり、 𝐴"𝐴(対称⾏列)の対⾓化(固有値)を求めるのと同じ問題に帰着。 1. 𝐴"𝐴 を計算。 2. それを対⾓化、すなわち固有値𝜎'と固有ベクトル 𝒗 をn個求める。 3. それらが、 Σ', 𝑉 となる。 4. Σと𝑉が求まったら、 𝐴𝒗 = 𝜎𝒖 より、𝒗 に対応する 𝒖求めて、 𝑼とする。 これは⼿計算⽤で、通常、コンピュータの数値演算は全く違う ⽅法(シフト付きQRなど) をとる。 特異値/特異ベクトル
  • 37. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 37 直感で SVD 出来ますか︖ 1. 𝐴 = 3 2. 𝐴 = 1 2 3. 𝐴 = 1 3 2 6 直感 or 計算で SVD 出来ますか︖ ポイント 𝐴 = 𝑈Σ𝑉! 単位直⾏⾏列 (⻑さ・⾓度を変えない) (回転と捉えて良い) 対⾓⾏列 (向きを変えない) (スケールと捉えて良い) 𝑈 𝑉 𝑈の次元は? 𝑉の次元は? ℝ" ℝ# 𝐴 ⾏空間 列空間 → = 1 3 1 = 1 5 1 2 5 1 = 1 5 1 −2 2 1 5 0 1 特異値/特異ベクトル
  • 38. Eigenfaces – Yale B Dataset By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 38 256値×32K 画素×64枚× 36⼈、から、特異値ベクトルを抽出
  • 39. 最初の 64 eigenfaces(ちょっと怖い…) By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 39
  • 40. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 40 顔データを元よりも少数 次元の基底によって復元 する。 基底は、U を特異値の⼩ さい⽅を削除ししまった 近似。 このU平⾯に新しい顔を 射影し、その座標(少数) をαという。このαを使っ て、新しい顔を表現する。 (データ圧縮) 顔を次元を順次増 やして復元。 効率は良くないが、 ⽝も表現できるよ。 (だいぶ怖い)
  • 41. 参照⽂献と 謝辞 • Linear Algebra for Everyone (⽇本語 来年) http://math.mit.edu/everyone/ • MIT OpenCourseWare 18.06 http://web.mit.edu/18.06/www/vi deos.shtml • A 2020 Vision of Linear Algebra https://ocw.mit.edu/resources/res -18-010-a-2020-vision-of-linear- algebra-spring-2020/ • マトリックスワールド https://anagileway.com/2020/09/ 29/matrix-world-in-linear-algebra- for-everyone/ • 4つの部分空間 Tシャツ https://anagileway.com/2020/06/ 04/prof-gilbert-strang-linear- algebra/ This work is inspired by Prof. Strangʼs books and lecture videos. I deeply appreciate his work, passion and personality. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 41
  • 42. By Kenji Hiranabe with the kindest help of Prof. Gilbert Strang 42 Tシャツ作った!
  • 43. Thank you for reading! Any comments or feedbacks are welcome to: Kenji Hiranabe (hiranabe@gmail.com) = 43