数学表达式魔训
Day 5
5.1 图与网络
Definition :An undirected network is a tuple
G
=
(
V
,
E
,
W
)
G = (\mathbf{V}, \mathbf{E}, \mathbf{W})
G=(V,E,W), where
V
\mathbf{V}
V is the set of nodes,
E
⊆
V
×
V
\mathbf{E} \subseteq \mathbf{V} \times \mathbf{V}
E⊆V×V, where
(
v
i
,
v
j
)
∈
E
⇔
(
v
j
,
v
i
)
∈
E
(v_i, v_j) \in \mathbf{E} \Leftrightarrow (v_j, v_i) \in \mathbf{E}
(vi,vj)∈E⇔(vj,vi)∈E is the set of edges.
w
i
j
∈
W
w_{ij} \in \mathbf{W}
wij∈W is the weighted of
(
v
i
,
v
j
)
(v_i, v_j)
(vi,vj), where
w
i
j
=
w
j
i
w_{ij} = w_{ji}
wij=wji.
5.2 树
- Let
ϕ
\phi
ϕ be the empty node, a tree is a triple
T
=
(
A
,
r
,
p
)
T=(\mathbf{A}, r, p)
T=(A,r,p) where
∙ A = { A 0 , A 1 , … , A 6 } ≠ ϕ \bull \mathbf{A} =\{A_0, A_1, \dots, A_6\}\neq\phi ∙A={A0,A1,…,A6}=ϕ is the set of nodes;
∙ r ∈ A \bull r \in \mathbf{A} ∙r∈A is the root node;
∙ p : A → A ∪ { ϕ } \bull p: \mathbf{A} \to\mathbf{A} \cup\{\phi\} ∙p:A→A∪{ϕ} is the parent mapping satisfying;
∙ p ( r ) = ϕ \bull p(r) = \phi ∙p(r)=ϕ
∙ ∀ a ∈ A , ∃ ! n ≥ 0 , st. p ( n ) ( a ) = r \bull \forall a \in \mathbf{A}, \exists ! n \geq 0, \text { st. } p^{(n)}(a) = r ∙∀a∈A,∃!n≥0, st. p(n)(a)=r - n=6;root=0;
parent[0]=-1; parent[1]=0; parent[2]=0; parent[3]=1;
parent[4]=1; parent[5]=2; parent[6]=2;
code:
public class Tree {
/**
* 节点数. 表示节点 A_0 至 A_{n-1}.
*/
int n;
/**
* 根节点. 0 至 n-1.
*/
int root;
/**
* 父节点.
*/
int[] parent;
/**
* 构造一棵树, 第一个节点为根节点, 其余节点均为其直接子节点, 也均为叶节点.
*/
public Tree(int paraN) {
n = paraN;
parent = new int[n];
parent[0] = -1; // -1 即 \phi
}// Of the constructor
}//Of class Tree
5.3 m叉树
-
child 数组:
{ ( 1 , 2 , 3 ) ; ( 4 , − 1 , 5 ) ; ( − 1 , − 1 , 6 ) ; ( − 1 , − 1 , − 1 ) ; ( − 1 , − 1 , − 1 ) ; ( − 1 , − 1 , − 1 ) ; ( − 1 , − 1 , − 1 ) } \{(1, 2, 3); (4, -1, 5); (-1, -1, 6); (-1, -1, -1); (-1, -1, -1); (-1, -1, -1); (-1, -1, -1)\} {(1,2,3);(4,−1,5);(−1,−1,6);(−1,−1,−1);(−1,−1,−1);(−1,−1,−1);(−1,−1,−1)} -
Let ϕ \phi ϕ be the empty node, a tree is a triple T = ( A , r , Σ , c ) T=(\mathbf{A}, r, \Sigma, c) T=(A,r,Σ,c) where
∙ A ≠ ϕ \bull \mathbf{A} \neq \phi ∙A=ϕ is the set of nodes;
∙ r ∈ A \bull r \in \mathbf{A} ∙r∈A is the root node;
∙ Σ = { 0 } \bull \Sigma = \{0\} ∙Σ={0} is the alphabet;
∙ c : ( A ∪ { ϕ } ) × Σ ∗ → A ∪ { ϕ } \bull c: (\mathbf{A} \cup \{\phi\}) \times \Sigma^{*} \rightarrow \mathbf{A} \cup\{\phi\} ∙c:(A∪{ϕ})×Σ∗→A∪{ϕ} satisfying ;
∙ ∀ a ∈ A , ∃ ! s ∈ Σ ∗ s.t. c ( r , s ) = a \bull \forall a \in \mathbf{A}, \exists ! s \in \Sigma^{*} \text { s.t. } c(r, s) = a ∙∀a∈A,∃!s∈Σ∗ s.t. c(r,s)=a
Day 6
6.1 决策表
A label distribution system is a tuple S = ( X , Y ) S = (\mathbf{X}, \mathbf{Y}) S=(X,Y) where X = [ x i j ] n × m ∈ R n × m \mathbf{X} = [x_{ij}]_{n \times m} \in \mathbb{R}^{n \times m} X=[xij]n×m∈Rn×m is the data matrix, Y = [ y i k ] n × l ∈ [ 0 , 1 ] n × l \mathbf{Y} = [y_{ik}]_{n \times l} \in [0, 1]^{n \times l} Y=[yik]n×l∈[0,1]n×l is the label matrix, s.t. ∑ k = 1 l y i k = 1 \sum_{k = 1}^l y_{ik} = 1 ∑k=1lyik=1, n n n is the number of instances, m m m is the number of features, and l l l is the number of labels.
6.2 示例讲解
min
v
(
j
)
E
(
v
(
j
)
)
=
∑
i
=
1
l
L
(
y
i
,
g
(
j
)
(
x
i
)
)
+
∑
i
=
l
+
1
l
+
u
v
i
(
j
)
L
(
g
‾
(
j
−
1
)
(
x
i
)
,
g
(
j
)
(
x
i
)
)
\min_{ \mathbf{v}^{(j)}} E\left( \mathbf{v}^{(j)}\right)= \sum_{i = 1}^{l} L\left(y_{i}, g^{(j)}(\mathbf{x}_{i})\right) + \sum_{i=l+1}^{l+u}v_{i}^{(j)}L\left(\overline{g}^{(j-1)}{(\mathbf{x}_i)}, g^{(j)}(\mathbf{x}_{i})\right)
minv(j)E(v(j))=∑i=1lL(yi,g(j)(xi))+∑i=l+1l+uvi(j)L(g(j−1)(xi),g(j)(xi))
涵义:在第
j
j
j个视角上,在输入为
v
(
j
)
\mathbf{v}^{(j)}
v(j) 的情况下,使模型在标记数据与伪标记数据上的预测损失最小。
优点:简介明了,变量名为出现混用的情况。
缺点:无法一次性讲整个多个视角之间的优化情况写出。