Dempster-Shafer Evidence Theory for Multimodality Classification
Author: Sijin Yu
*本文的举例、图片完全参考了 github 用户 Roy 的博客 [1]. 本文在其基础上增加了数学的形式化表达, 详细了其例, 重画了图片.
1. Discernment Frame (识别框架)
识别框架 (Discernment Frame) 指所有可能的基本事件的集合. 例如:
Θ
=
{
θ
1
,
θ
2
,
⋯
,
θ
n
}
\Theta =\{\theta_1,\theta_2,\cdots,\theta_n\}
Θ={θ1,θ2,⋯,θn}
就是一个由
n
n
n 个两两互斥的基本事件构成的 discernment frame.
举例参考:
参考 [1] 中的举例, 考虑一个灯, 可能发出 R, G, B 三种颜色的光. 因此这里 n = 3 n =3 n=3, 这三种基本事件为 θ 1 = R \theta_1=R θ1=R 表示发红色光, θ 2 = G \theta_2=G θ2=G 表示发绿色的光, θ 3 = B \theta_3=B θ3=B 表示发绿色的光. 则 discernment frame 为 Θ = { θ 1 , θ 2 , θ 3 } = { R , G , B } \Theta =\{\theta_1, \theta_2, \theta_3\} =\{R, G, B\} Θ={θ1,θ2,θ3}={R,G,B}.
2. Mass Function (质量函数)
给定 discernment frame
Θ
\Theta
Θ, 质量函数 (Mass Function) 是定义在幂集
2
Θ
2^\Theta
2Θ 上的函数
M
\mathcal M
M, 定义为:
M
:
2
Θ
→
[
0
,
1
]
\mathcal M:2^\Theta\to [0,1]
M:2Θ→[0,1]
Mass function
M
\mathcal M
M 满足两个性质,
-
空集的 mass 为 0, 即
M ( ∅ ) = 0 \mathcal M(\varnothing)=0 M(∅)=0 -
所有可能的组合的 mass 之和为 1, 即
∑ A ⊆ Θ M ( A ) = 1 \sum_{A\sube \Theta}\mathcal M(A)=1 A⊆Θ∑M(A)=1
举例参考:
Mass 的意义是各种假设的可能性. 在上面的举例中, 假设一个观察者观测后, 对每个假设分配了 mass 值, 如下:
假设 含义 Mass ∅ \varnothing ∅ 不发光 0 { R } \{R\} {R} 发红光 0.35 { G } \{G\} {G} 发绿光 0.15 { B } \{B\} {B} 发蓝光 0.25 { R , G } \{R, G\} {R,G} 发红光或绿光 0.05 { G , B } \{G, B\} {G,B} 发绿光或蓝光 0.04 { B , R } \{B, R\} {B,R} 发蓝光或红光 0.06 { R , G , B } \{R, G, B\} {R,G,B} 发某一种光 0.1 画成 Venn Diagram 如下:
3. Belief Function (信度函数)
集合
A
⊆
Θ
A\sube \Theta
A⊆Θ 的信度 (Belief) 定义为:
A
A
A 所有子集的 mass 之和. 即:
B
e
l
(
A
)
=
∑
B
⊆
A
M
(
B
)
Bel(A)=\sum_{B\sube A}\mathcal M(B)
Bel(A)=B⊆A∑M(B)
举例参考:
在上面的例子中, 各种组合的 belief 为:
- B e l ( R ) = M ( R ) = 0.35 Bel(R)=\mathcal M(R) = 0.35 Bel(R)=M(R)=0.35
- B e l ( G ) = M ( G ) = 0.15 Bel(G)=\mathcal M(G) = 0.15 Bel(G)=M(G)=0.15
- B e l ( B ) = M ( B ) = 0.25 Bel(B)=\mathcal M(B)=0.25 Bel(B)=M(B)=0.25
- B e l ( R G ) = M ( R G ) + M ( R ) + M ( G ) = 0.55 Bel(RG)=\mathcal M(RG) + \mathcal M(R) + \mathcal M(G)=0.55 Bel(RG)=M(RG)+M(R)+M(G)=0.55
- B e l ( G B ) = M ( G B ) + M ( G ) + M ( B ) = 0.44 Bel(GB)=\mathcal M(GB) + \mathcal M(G) + \mathcal M(B)=0.44 Bel(GB)=M(GB)+M(G)+M(B)=0.44
- B e l ( B R ) = M ( B R ) + M ( B ) + M ( R ) = 0.66 Bel(BR)=\mathcal M(BR) + \mathcal M(B) + \mathcal M(R)=0.66 Bel(BR)=M(BR)+M(B)+M(R)=0.66
- B e l ( R G B ) = M ( R G B ) + M ( R G ) + M ( G B ) + M ( B R ) + M ( R ) + M ( G ) + M ( B ) = 1 Bel(RGB)=\mathcal M(RGB)+\mathcal M(RG)+\mathcal M(GB)+\mathcal M(BR) + \mathcal M(R) +\mathcal M(G)+ \mathcal M(B)=1 Bel(RGB)=M(RGB)+M(RG)+M(GB)+M(BR)+M(R)+M(G)+M(B)=1
注意, 这里的数学符号不太严谨, 因为函数 B e l ( ⋅ ) , M ( ⋅ ) Bel(\cdot),\mathcal M(\cdot) Bel(⋅),M(⋅) 的输入都是集合. 这里的 B e l ( R ) Bel(R) Bel(R) 实际上应该为 B e l ( { R } ) Bel (\{R\}) Bel({R}), M ( R G B ) \mathcal M(RGB) M(RGB) 实际上应该为 M ( { R , G , B } ) \mathcal M(\{R, G,B\}) M({R,G,B}), 其余同理. 这里采用这样的写法是为了简洁.
4. Plausibility Function (似然函数)
集合
A
⊆
Θ
A\sube \Theta
A⊆Θ 的似然 (Plausibility) 定义为: 与
A
A
A 相交的所有集合的 mass 之和. 即:
P
l
s
(
A
)
=
∑
B
∩
A
≠
∅
M
(
B
)
Pls(A)=\sum_{B\cap A\neq\varnothing}\mathcal M(B)
Pls(A)=B∩A=∅∑M(B)
举例参考:
在上面的例子中, 各种组合的 plausibility 为:
- P l s ( R ) = M ( R ) + M ( R G ) + M ( B R ) + M ( R G B ) = 0.56 Pls(R)=\mathcal M(R) + \mathcal M(RG)+\mathcal M(BR)+\mathcal M(RGB)=0.56 Pls(R)=M(R)+M(RG)+M(BR)+M(RGB)=0.56
- P l s ( G ) = M ( G ) + M ( R G ) + M ( G B ) + M ( R G B ) = 0.34 Pls(G)=\mathcal M(G) + \mathcal M(RG)+\mathcal M(GB)+\mathcal M(RGB)=0.34 Pls(G)=M(G)+M(RG)+M(GB)+M(RGB)=0.34
- P l s ( B ) = M ( B ) + M ( G B ) + M ( B R ) + M ( R G B ) = 0.45 Pls(B)=\mathcal M(B) + \mathcal M(GB)+\mathcal M(BR)+\mathcal M(RGB)=0.45 Pls(B)=M(B)+M(GB)+M(BR)+M(RGB)=0.45
- P l s ( R G ) = M ( R ) + M ( G ) + M ( G B ) + M ( B R ) + M ( R G ) + M ( R G B ) = 0.75 Pls(RG)=\mathcal M(R)+\mathcal M(G)+\mathcal M(GB)+\mathcal M(BR)+\mathcal M(RG)+\mathcal M(RGB)=0.75 Pls(RG)=M(R)+M(G)+M(GB)+M(BR)+M(RG)+M(RGB)=0.75
- P l s ( G B ) = M ( G ) + M ( B ) + M ( G B ) + M ( B R ) + M ( R G ) + M ( R G B ) = 0.65 Pls(GB)=\mathcal M(G)+\mathcal M(B)+\mathcal M(GB)+\mathcal M(BR)+\mathcal M(RG)+\mathcal M(RGB)=0.65 Pls(GB)=M(G)+M(B)+M(GB)+M(BR)+M(RG)+M(RGB)=0.65
- P l s ( B R ) = M ( B ) + M ( R ) + M ( G B ) + M ( B R ) + M ( R G ) + M ( R G B ) = 0.85 Pls(BR)=\mathcal M(B)+\mathcal M(R)+\mathcal M(GB)+\mathcal M(BR)+\mathcal M(RG)+\mathcal M(RGB)=0.85 Pls(BR)=M(B)+M(R)+M(GB)+M(BR)+M(RG)+M(RGB)=0.85
- P l s ( R G B ) = M ( R ) + M ( G ) + M ( B ) + M ( G B ) + M ( B R ) + M ( R G ) + M ( R G B ) = 1 Pls(RGB)=\mathcal M(R)+\mathcal M(G)+\mathcal M(B)+\mathcal M(GB)+\mathcal M(BR)+\mathcal M(RG)+\mathcal M(RGB)=1 Pls(RGB)=M(R)+M(G)+M(B)+M(GB)+M(BR)+M(RG)+M(RGB)=1
注意, 这里的数学符号不太严谨, 因为函数 P l s ( ⋅ ) , M ( ⋅ ) Pls(\cdot),\mathcal M(\cdot) Pls(⋅),M(⋅) 的输入都是集合. 这里的 P l s ( R ) Pls(R) Pls(R) 实际上应该为 P l s ( { R } ) Pls (\{R\}) Pls({R}), M ( R G B ) \mathcal M(RGB) M(RGB) 实际上应该为 M ( { R , G , B } ) \mathcal M(\{R, G,B\}) M({R,G,B}), 其余同理. 这里采用这样的写法是为了简洁.
5. Probability Measure (概率测度)
给定 discernment frame
Θ
\Theta
Θ, 概率测度 (Probability Measure) 是一个定义在集合
Θ
\Theta
Θ 上的函数
P
\mathcal P
P, 定义为:
P
:
Θ
→
[
0
,
1
]
\mathcal P:\Theta\to [0,1]
P:Θ→[0,1]
Probability measure 满足以下性质:
-
归一性, 即:
∑ θ ∈ Θ P ( θ ) = 1 \sum_{\theta\in\Theta}\mathcal P(\theta)=1 θ∈Θ∑P(θ)=1 -
可加性, 即:
P ( ⋃ i θ i ) = ∑ i P ( θ i ) \mathcal P\left(\bigcup_{i}\theta_i\right)=\sum_{i}\mathcal P(\theta_i) P(i⋃θi)=i∑P(θi)注意, 可加性的成立条件是 θ i 1 , θ i 2 , ⋯ , θ i m \theta_{i_1},\theta_{i_2},\cdots,\theta_{i_m} θi1,θi2,⋯,θim 为两两互斥的. 而这正是 discernment frame Θ \Theta Θ 的定义给出的, 因此可加性自然成立.
即然 θ i 1 , θ i 2 , ⋯ , θ i m ( m ≥ 2 ) \theta_{i_1},\theta_{i_2},\cdots,\theta_{i_m} (m\geq 2) θi1,θi2,⋯,θim(m≥2) 是两两互斥的, 因此下面的式子总成立:
P ( ⋂ i θ i ) = 0 \mathcal P\left(\bigcap_{i}\theta_i\right)=0 P(i⋂θi)=0
为了与我们上面使用 R G B RGB RGB 表示 { R , G , B } \{R, G, B\} {R,G,B} 的符号保持一致性, 我们这里使用符号 P ( R G B ) : = P ( R ∪ G ∪ B ) \mathcal P(RGB):=\mathcal P(R\cup G\cup B) P(RGB):=P(R∪G∪B), 这与传统的 P ( R G B ) \mathcal P(RGB) P(RGB) 表示 P ( R ∩ G ∩ B ) \mathcal P(R\cap G\cap B) P(R∩G∩B) 不同 (后者在我们的例子中总是为 0, 没什么意思). 在这样的表述下, P ( R G ) \mathcal P (RG) P(RG) 表示“该灯发红光或者发绿光”的概率测度, 其余的符号同理.
这里需要区分概率测度 P \mathcal P P 和前面定义的质量函数 M \mathcal M M 的区别.
P \mathcal P P 的定义域是 Θ \Theta Θ, 即我们所理解的“概率”含义. M \mathcal M M 的定义域是 2 Θ 2^\Theta 2Θ, 它衡量了观测者对各种可能性判断的确定性 (这一解释在下文会再次说明).
6. 概率测度的界
任意一个子集
A
⊆
Θ
A\sube \Theta
A⊆Θ 的概率测度定义为
A
A
A 中元素之并的概率测度, 即
P
(
A
)
:
=
P
(
⋃
θ
∈
A
θ
)
=
∑
θ
∈
A
P
(
θ
)
\mathcal P(A):=\mathcal P\left(\bigcup_{\theta\in A}\theta\right)=\sum_{\theta\in A}P(\theta)
P(A):=P(θ∈A⋃θ)=θ∈A∑P(θ)
其中, 第二个等式由 probability measure 的可加性给出.
P
(
A
)
\mathcal P(A)
P(A) 总是以 belief 为下界, 以 plausibility 为上界, 即:
B
e
l
(
A
)
≤
P
(
A
)
≤
P
l
s
(
A
)
Bel(A)\leq \mathcal P(A) \leq Pls(A)
Bel(A)≤P(A)≤Pls(A)
7. Subjective Logic (主观逻辑)
使用主观逻辑 (Subjective Logic), 可以通过先验概率, 计算后验概率. 具体的, 若定义了 discernment frame
Θ
\Theta
Θ, 在其上定义了 mass function
M
\mathcal M
M,
∀
θ
∈
Θ
\forall \theta\in\Theta
∀θ∈Θ, 给定先验概率分布
q
(
θ
)
q(\theta)
q(θ), 则后验概率
p
(
θ
)
p(\theta)
p(θ) 可以如此得出:
p
(
θ
)
=
M
(
{
θ
}
)
+
∑
θ
∈
A
⊆
Θ
M
(
A
)
⋅
q
(
θ
∣
A
)
p(\theta) = \mathcal M(\{\theta\}) +\sum_{\theta\in A\sube\Theta}\mathcal M(A)\cdot q(\theta|A)
p(θ)=M({θ})+θ∈A⊆Θ∑M(A)⋅q(θ∣A)
举例参考:
在上面的 RGB 灯例子中, 若给出先验概率分布如下:
q ( R ) q(R) q(R) q ( G ) q(G) q(G) q ( B ) q(B) q(B) 0.5 0.3 0.2 在上面 mass 分配的情况下, 可得修正的后验分布为:
p ( R ) p(R) p(R) p ( G ) p(G) p(G) p ( B ) p(B) p(B) 0.474 0.223 0.303 在上面的例子可见, mass 的数学意义是衡量不确定性, M ( A ) \mathcal M (A) M(A) 即为分配给子集 A A A 的证据 (Evidence).
8. Dempster-Shafer Evidence Combination (DS 证据合成)
假设有两个观察者, 它们观测的 mass function 分别为 M 1 \mathcal M_1 M1 和 M 2 \mathcal M_2 M2.
M
1
\mathcal M_1
M1 和
M
2
\mathcal M_2
M2 的冲突度 (Conflict Degree)
γ
\gamma
γ 定义如下:
γ
=
∑
A
∩
B
=
∅
,
A
,
B
∈
Θ
M
1
(
A
)
⋅
M
2
(
B
)
\gamma=\sum_{A\cap B= \varnothing,A,B\in\Theta} \mathcal M_1(A)\cdot \mathcal M_2(B)
γ=A∩B=∅,A,B∈Θ∑M1(A)⋅M2(B)
冲突度衡量了 M 1 \mathcal M_1 M1 和 M 2 \mathcal M_2 M2 的不一致性.
- γ ∈ [ 0 , 1 ] \gamma\in[0,1] γ∈[0,1] 总是成立.
- 若 γ = 0 \gamma=0 γ=0, 表示两个证据源完全一致.
- 若 γ = 1 \gamma=1 γ=1, 表示两个证据源完全冲突.
两个证据源的 mass function
M
1
\mathcal M_1
M1 和
M
2
\mathcal M_2
M2 的正交和 (Orthogonal Sum)
⊕
\oplus
⊕ 为融合后的 mass function
M
\mathcal M
M. 具体的定义如下:
M
(
A
)
=
M
1
⊕
M
2
(
A
)
:
=
1
1
−
γ
∑
B
∩
C
=
A
M
1
(
B
)
M
2
(
C
)
\mathcal M(A)=\mathcal M_1\oplus\mathcal M_2(A):=\frac{1}{1-\gamma}\sum_{B\cap C=A}\mathcal M_1(B)\mathcal M_2(C)
M(A)=M1⊕M2(A):=1−γ1B∩C=A∑M1(B)M2(C)
9. 用于多模态分类任务上的可能性
令 discernment frame Θ \Theta Θ 的各元素定义为分类的各类别.
对于第 i i i 个模态, 其 Encoder E i E_i Ei 处理这一模态的输入数据 x i x_i xi, 得到了对分类结果的先验分布 q i ( θ ) q_i(\theta) qi(θ), ∀ θ ∈ Θ \forall \theta\in\Theta ∀θ∈Θ. 同时, 使用一个模型去估计这个 Encoder 对分类结果的证据 mass function M i ( θ ) \mathcal M_i(\theta) Mi(θ), ∀ θ ∈ Θ \forall \theta\in\Theta ∀θ∈Θ.
令可学习参数
η
i
∈
[
0
,
1
]
\eta_i\in[0,1]
ηi∈[0,1] 用于衡量模态
i
i
i 的可靠程度. 使用下面的方法更新 mass function
M
i
\mathcal M_i
Mi:
M
i
←
η
i
M
i
+
(
1
−
η
i
)
M
?
\mathcal M_i\gets \eta_i\mathcal M_i + (1-\eta_i)\mathcal M_{?}
Mi←ηiMi+(1−ηi)M?
这里,
M
?
\mathcal M_{?}
M? 表示茫然的质量函数 (Vacuous Mass Function), 其定义为
M
?
(
Θ
)
=
1
\mathcal M_?(\Theta)=1
M?(Θ)=1.
使用
η
i
\eta_i
ηi 对所有模态的先验分布做融合:
q
(
θ
)
=
1
∑
η
i
∑
i
η
i
q
i
(
θ
)
q(\theta)=\frac{1}{\sum \eta_i}\sum_i\eta_iq_i(\theta)
q(θ)=∑ηi1i∑ηiqi(θ)
使用 DS Evidence Combination 对所有 mass function 做融合:
M
=
⨁
i
M
i
\mathcal M=\bigoplus_{i}\mathcal M_i
M=i⨁Mi
最后, 使用 Subjective Logic 可以得到后验分布
p
(
θ
)
p(\theta)
p(θ) 为分类结果.
这种融合, 对多模态中存在某一模态可靠度不高, 但难以确定哪一模态可靠度不高, 需要模型自己学习每一模态的可靠度的情况, 有很大的促进意义. 此外, 这里的“多模态”也可以推广为“多分类器”、“多尺度”.
Reference List
[1] https://cf020031308.github.io/wiki/dempster-shafer-theory-and-subjective-logic/
[2] Shafer, G.: A mathematical theory of evidence, vol. 42. Princeton University Press (1976)