55
Topology of musical data Topology of musical data ~introduction to Persitent homology and TDA~ ~introduction to Persitent homology and TDA~ プログラマのための数学勉強会2015/07/24 @simizut22

topology of musical data

Embed Size (px)

Citation preview

Page 1: topology of musical data

Topology of musical dataTopology of musical data~introduction to Persitent homology and TDA~~introduction to Persitent homology and TDA~

プログラマのための数学勉強会2015/07/24@simizut22

Page 2: topology of musical data

⾃自⼰己紹介⾃自⼰己紹介元 topology cluster 現 c++er 数理計画がお仕事 荷物を積む ときどきグラフの対称性 やっぱり荷物を積む

Page 3: topology of musical data

*第 3 回 プログラマのための数学勉強会

中の⼈人です中の⼈人です

続続・・⾃自⼰己紹介⾃自⼰己紹介

Page 4: topology of musical data

後⽇日こちらの池⽥田後⽇日こちらの池⽥田ァァッァァッ先輩に指摘されました先輩に指摘されました

Page 5: topology of musical data

発表後,怒られた発表後,怒られた((⾯面⽩白いので消さない⾯面⽩白いので消さない))

Page 6: topology of musical data

ちなみに今朝の僕ちなみに今朝の僕

Page 7: topology of musical data

contentscontents

⾳音楽の空間 Persistent homology applying to music

Page 8: topology of musical data

1. 1. ⾳音楽の空間⾳音楽の空間

リズム~ネックレス記法~1. event 間距離2. event 列の距離

ピッチ(⾳音の⾼高低)1. ピッチクラス距離2. コードクラス距離

Page 9: topology of musical data

notation1notation1R :

Z :

実数全体のなす空間

整数全体のなす空間

S :n 次元球⾯面n

特に

S = R/Z1

i.e. [x] = [y] ⇔ x − y ∈ Z

T = S × ... × Sn 1 1

Page 10: topology of musical data

notation2notation2

: symmetric group∑n

Z = Z/nZn

C = ⟨σ⟩ ∈ 2 ∣σ ≠ id (0 < k < n)n { Σn k }

G ∈ Σ , G ≅ Zn n

すなわち,

なるもの全体を集めたもの

Page 11: topology of musical data

補⾜足補⾜足・・対称群対称群n 次対称群・ n 個の要素を purmute するすべての⽅方法・あみだくじで考えるとわかりやすい・積: 2つのあみだを縦につなげる・逆元: あみだの上下を逆転させる・世の中のどこにでも表れてくる

例例((全くの蛇⾜足全くの蛇⾜足))

G = (V , E) : graph with ∣V ∣ = n

Σ ↷ Gnこのとき,頂点の名前の付け替えにより

Text

辺の接続を保存するものをグラフの同型と⾔言う

Page 12: topology of musical data

補⾜足:群作⽤用補⾜足:群作⽤用・・軌道分解軌道分解・・商空間商空間

X ↶ G : action of G on X

このとき,次のような軌道分解ができる

X = x ⋅ g∣g ∈ G⨆λ∈Λ { λ }

各軌道を要素とした空間i.e. 同じ軌道上の点を同⼀一視した空間を商空間といい

X/G

と書く

Page 13: topology of musical data

群作⽤用の例群作⽤用の例R/Z = S1

R /Z ≅ C/⟨1, ω⟩ ≅ T2 2Z

2

X = X × ... × X ↶n ∑n

空間 X が与えられたとき

に対称群の(右)作⽤用が定まる

i.e. (x , ..., x ) ⋅ σ = (x , ..., x )1 n σ (1)−1 σ (n)−1

ex1.

ω ∈ C, im(ω) > 0 : givenex2.

ex3.

Page 14: topology of musical data

距離の定義距離の定義d : X × X → R≥0 が距離が距離⇔ 1. x = y ⇔ d(x, y) = 0

2. d(x, y) = d(y, x) (x, y ∈ X)

3. d(x, y) + d(y, z) ≤ d(x, z)

例例euclid distance in RN

hyperbolic distance in HN

elliptical distance in SN

Page 15: topology of musical data

1.1 1.1 リズムのネックレス記法リズムのネックレス記法

necklace notation**[1]

1 周が⼀一つの"Rhythm"○: ⾳音の発⽣生 point

・Safi al-Din al-Urmawi(1216 - 1294) がおそらく最初に提唱 ・アフリカン⾳音楽に対し特に適切 Willie Anku(2000)

Page 16: topology of musical data

1.1.1 rhythm 1.1.1 rhythm のの ネックレス距離ネックレス距離

def 1.1(necklace distance)

d (f , g) = min(s, 1 − s)N

where s = ∣f − g∣ mod Z

Page 17: topology of musical data

def 1.2(rhythm distance)

f , g ∈ T n

d (f , g) = min d (f , g )R ⟨σ⟩∈Cn∑i=1

nN i σ(i)

1.1.2 rhythm 1.1.2 rhythm の距離の距離

2 つの event タイミング列 (f ) , (g )i i=in

i i=1n

は巡回させて⼀一番近いのを考えるのが⾃自然だね

Page 18: topology of musical data

1.2 1.2 ピッチクラスピッチクラス

・C→C# と G#→A は同じ距離⇒ log の⽅方が better・1 オクターブの差は同じ⇒ cyclic なモデル

この考えで距離を導⼊入

Page 19: topology of musical data

1.2.1 pitch 1.2.1 pitch クラス距離クラス距離def 2.1(pitch class distance)

d (f , g) = min(s, 1 − s)P C

where s = ∣log (f) − log (g)∣ mod Z2 2

def(pitch class)(Rahn 80)′

f , g ∈ R = x ∈ R∣x > 0+ { }

d (f , g) = 0P C による同値類

Page 20: topology of musical data

和⾳音和⾳音(chord)(chord)はどうしようかはどうしようか

三和⾳音root と、root の3度上の⾳音(第3⾳音)と、root の5度上の⾳音(第5⾳音)の3つの⾳音から成る和⾳音

四和⾳音(または七の和⾳音)三和⾳音に、root の7度上の⾳音(第7⾳音という)を加えた和⾳音

五和⾳音(または九の和⾳音)四和⾳音に、root の9度上の⾳音(第9⾳音)を加えた和⾳音

ref: https://ja.wikipedia.org/wiki/%E5%92%8C%E9%9F%B3

ここで僕みたいに⾳音楽を知らない⼈人向け

要はいくつかの⾳音を同時に出すみたいだ

Page 21: topology of musical data

和⾳音和⾳音(chord)(chord)はどうしようかはどうしようか⾳音の重ね合わせなのだから,⾜足せばいいのでは??

愚直に定義してみる

def(mistake)

f = (f ) , g = (g )i i=1n

i i=1n

d (f , g) = d (f , g )′ ∑i=1n

P C i i

転回(involution) しても同じと考えたいときには,これではまずい*区別することもあるようだが,今回は転回も同じとする⽴立場で考える

Page 22: topology of musical data

1.2.2 chord1.2.2 chordクラス距離クラス距離

def 2.2(chord class distance)

d (f , g) = min d (f , g )CC σ ∑i=1n

P C i σ(i)

for f , g ∈ T n

where σ goes through ∑n

(f )i i=1n と書いてはいるが,この index は本質でない

⇒対称群の作⽤用で不変な距離にしよう

Page 23: topology of musical data

練習問題練習問題

先ほど定義したそれぞれの関数が三⾓角不等式(定義3 番⺫⽬目の条件)を満たすことを確認する

Page 24: topology of musical data

1. 1. ⽣生息する空間⽣生息する空間for X : space

n-重積空間 X ∋ fn

と書くX

の添え字付を無視した空間を

の n-次対称積といい

Sp (X) = X /nn ∑n

def(symmetric product)Sp (X)n

**remark:対称積は要素数 n 以下のなす集合とは違い multiplicity も含むので注意

Page 25: topology of musical data

1. 1. ⾳音楽が⽣生息する空間⾳音楽が⽣生息する空間G ⊂ : subgroup∑n に対し

Sym (X) = X /GnG n と書くことにする

Sym (X) = Sp (X)nG

n

G = ∑n例1.

例2. G = ∗Sym (X) = Xn

G n

例3. G = ∑n−1

Sym (X) = Sp (X) × XnG

n−1

Page 26: topology of musical data

1. 1. ⾳音楽が⽣生息する空間⾳音楽が⽣生息する空間

先ほどの距離空間の議論から...

Sym (S )nZn 1rhythm のなす空間の⽣生息地:

和⾳音のなす空間の⽣生息地: Sp (S )n1

Page 27: topology of musical data

実データだと...n 固定ならいいけど,n 混ざったらどうすんの??

n=∞ にすると⼤大きすぎる

サンプルデータから空間を再現しよう

機械学習する??

Page 28: topology of musical data

Topological Data Analysis Topological Data Analysis しようしよう

Page 29: topology of musical data

2.1. 2.1. まずはまずはhomologyhomology簡単のため

def 2.1.1(simplex)

R (N : large)N 内の単体複体のみ考える

RN p , p , ..., p0 1 kの k+1 点 が線形独⽴立な k ベクトル, ...,p p0 1 p p0 k を与えるとき,凸集合

λ p ∈ R ∣λ ≥ 0, λ = 1{∑ i iN

i ∑ i }

を k 単体と⾔言い ⟨p , ..., p ⟩0 k で表す

Page 30: topology of musical data

faceface

τ = ⟨p , ..., p ⟩ n simplex0 n に対し

σ = ⟨p , ..., p ⟩ where i , ..., i ⊂ [n]i0 ik{ 0 k}

を k-次元の face と⾔言い, σ ≺ τ と書く

標準単体とそのface

Page 31: topology of musical data

def 2.1.1(simplicial complex)

RN 内の有限個の単体の集まり K が次を満たすとする

1. τ ∈ K, σ ≺ τ ⇒ σ ∈ K

2. τ , σ ∈ K ⇒ τ ∩ σ ≺ λ(λ = τ , σ)を単体複体というKこのような

2 は単体通しの張り合わせがうまくいくことを表している

Page 32: topology of musical data

2.1.2 chain complex2.1.2 chain complex

K : simplicial complex

K = rank k simplicesk { }

R = Z, k[x]係数環を で固定して以下議論する

C (K) = R⟨K ⟩ = r ⋅ σk k {∑r∈R,σ∈Kk}

C (K) = C (K)∗ { k }k

def(chain complex)

Page 33: topology of musical data

d : C (K) → C (K)k k k−1

def : (boundary operator)

を次で与える

d ⟨v ...v ⟩ = (−1) ⟨v ... ...v ⟩k 0 k ∑i=0k i

0 vi k

lem :1. d ∘ d = 0so

2. Im(d) ⊂ ker(d)

Page 34: topology of musical data

def : (homology)

H (K) = Z (K)/B (K) : homologyk k k

Z (K) = ker(d ) ⊂ K : cyclek k k

B (K) = Im(d ) ⊂ C (K) : boundaryk k+1 k

lemma の 2 から次の定義ができる

Page 35: topology of musical data

chain complex chain complex があればがあればhomology homology ができるができる

Page 36: topology of musical data

2.1.3 2.1.3 ⾃自然性⾃自然性((関⼿手性関⼿手性))def(chain map)

K, L : chain complex

f = (f : K → L ) is chain mapk k k

⇔ f ∘ d = d ∘ f

prop

f : K → L is chain map

⇒ f induce f : H (K) → H (L)∗ ∗ ∗

K ⊂ L : subcomplex特に下の包含写像 

Page 37: topology of musical data

2.2. persistent homology2.2. persistent homology

・homology は空間⇒chain 複体により定義できた

・homology は空間の⽳穴を検出する

・persistent homology は単体複体の増加列により定まる

・persistent homology は単体の⽣生成と消滅を検出

Page 38: topology of musical data

2.2.1 2.2.1 定義頑張れ定義頑張れ: K ⊂ K ⊂ ... ⊂ K ⊂ ...K 0 1 t

単体複体の filtration: given

2. C (K ) = Z σ : free Z modulekt ∑σ∈Kk

t 2 2

def

1. T (σ) = t ⇔ σ ∈ K \Kt t−1

4. x : C ( ) → C ( ) : action of xk K k K

3. C ( ) = C (K )k K ⨁t kt

x(c , c1, ..) = (0, c , c , ...) : right shift0 0 1

Page 39: topology of musical data

2.2.1 2.2.1 定義頑張る定義頑張る

def

i : C (K ) → C ( )t kt

k K

i (σ) = (0, 0, ⋯ , σ, 0, ⋯)t

を次で定義する

k-chain group C ( )k K は基底として次を持つ(ex)

Θ = e = i (σ)∣σ ∈ Kk { σ T (σ) k}

d : C( ) → C( )K K

de = (x )eσ ∑i=0k T (σ)−T (σ )i

σi

Page 40: topology of musical data

2.2.1 2.2.1 頑張る頑張るprop

1. d (C (K )) ⊂ C (K )k kt

k−1t

2. d ∘ d = 0

(C ( ), d) is a chain complex∗ K

cor

みなさん,お疲れ様です

僕はもっと疲れました

Page 41: topology of musical data

def(P ersitent Homology)やっと定義やっと定義

: K ⊂ K ⊂ ... ⊂ K ⊂ ...K 0 1 t

P H ( ) = H (C( , d))∗ K ∗ K

単体複体の filtration

に対し,Persitent Homology を次で与える

実は,chain map に関する⾃自然性を使っても定義できる...

Page 42: topology of musical data

異なる定義異なる定義

i : K → K (i < j) : inclusion(chain)i,ji j

がchain map である事より次の準同型が誘導される

φ = H (i ) : H (K ) → H (K )pi,j

pi,j

p i p j

γ ∈ Im(φ )pi,j

を persistent homology class と呼ぶ

Page 43: topology of musical data

⽣生成消滅と⽣生成消滅とindexindexdef(born, death, index)a)γ ∈ H (K ) is born at K ⇔ γ ∉ Im(φ )p i i p

i−1,i

i.e. γ is not a persistent

b) γ : born at K dies entering Ki j

1. φ (γ) ∈ Im(φ )i,j i−1,j

2. φ (γ) ∉ Im(φ )i,j−1 i−1,j−1

c) for γ : born at K dies entering Ki j

(index persistence of γ) = j − i

Page 44: topology of musical data

born at K since it does not lie in the image of K ,i i−1

dies entering K since this is the first time its image merges into the image of Kj i−1

続続・・⽣生成消滅⽣生成消滅

Page 45: topology of musical data

3. apply to music3. apply to music

定義はわかったfilatration がいるんだな

え,どうしよう...

⼤大丈夫,そのために距離を⼊入れたんだ

Page 46: topology of musical data

単体複体の例単体複体の例Čech

Vietoris-Rips

alpha

wrap

witness

参照: The Morse theory of Čech and Delaunay filtrations

Page 47: topology of musical data

3.2. Vietris-Rips 3.2. Vietris-Rips 複体複体P = x ⊂ R{ i}i=1

m Nsample dataとする

B (x ) = y ∈ R ∣d(x , y) < r : open ballr i { Ni }

として,単体複体 R(P , r) = (V , Σ)を以下のように定める

V = 1, .., m{ }

Σ = i , .., i ⊂ V ∣B (x ) ∩ B (x ) ≠ ϕ{{ 0 k} r is r it}

Page 48: topology of musical data

r < r ⇒ R(P , r ) ⊂ R(P , r )0 1 0 1

明らかに

3.2. Vietris-Rips 3.2. Vietris-Rips 複体複体

ϵ : small ⇒ R(P , ϵ) is discrete

r : large ⇒ R(P , r) is connected

⾳音楽の例では空間が有界なので

半径の列を取ることで 複体の filtration が作れるデータの距離matrix→⾃自然にfiltrationは作れる

やったね(^^)/

Page 49: topology of musical data

ごめんなさい.ごめんなさい.実際の実際のapply apply を紹介する⼒力を紹介する⼒力

が付きましたが付きました

Page 50: topology of musical data

具体的な計算には具体的な計算には......⽅方法1. 境界作⽤用素の smith 標準形を計算→chain complex の size に⾮非常に弱くなる betti数など特別な位相不変量が欲しいのであれば⽅方法2. discrete morse theory を前処理に⼊入れる→chain complex のサイズを⼩小さくする ⽅方法3(bar-code)⼀一番メジャーな気がする ⽅方法4(ちょっと最近の話し)well-group と⾔言うのを考える

Page 51: topology of musical data

well-group(advanced-topic)well-group(advanced-topic)

def(well − group)Im[Φ : H (f (U)) → H (f (U))]∗

c −1∗

−1

M : compact oriented mfdm

f : X → M

w/ Φ = ∩f (ω), ω is P oincare dual to[M ]∗

is called well group

Page 52: topology of musical data

well-group(advanced-topic)well-group(advanced-topic)P rop :1. well group is common in fibres above U

i.e. persistent over U

2. well group is stable up to homotopy of f

well-group やそれを⽤用いた etalage を使うとよさげ

参考:homology and robustness of level and interlevel setshttp://pub.ist.ac.at/~edels/Papers/2013-J-04-InterlevelSets.pdf

Page 54: topology of musical data

Hall, Rachel Wells."Geometrical music theory."SCIENCE-NEW YORK THEN WASHINGTON- 320.5874 (2008): 328.

Sethares, William A., and Ryan Budney."Topology of musical data."Journal of Mathematics and Music 8.1 (2014): 73-92.

Bergomi, Mattia G., and Alessandro Portaluri."Modes in modern music from a topological viewpoint."arXiv preprint arXiv:1309.0687 (2013).

参考⽂文献参考⽂文献

Page 55: topology of musical data

教科書教科書

平岡 裕章タンパク質構造とトポロジー: パーシステントホモロジー群⼊入⾨門共⽴立出版, 2013

Edelsbrunner, HerbertA Short Course in Computational Geometry and TopologySpringer, 2014.

Edelsbrunner, Herbert, and John HarerComputational topology: an introductionAmerican Mathematical Soc., 2010. pdf lnk