-
写出下图的邻接矩阵。
E = [ 0 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0 ] \mathbf{E}=\begin{bmatrix} 0 & 1 & 1&1\\ 1 & 0 &1 &0 \\1 & 1& 0 & 1\\1 & 0 & 1 &0\end{bmatrix} E=⎣⎢⎢⎡0111101011011010⎦⎥⎥⎤ -
定义无向网络
Definition 1. A undirected net is a tuple G = ( V , w ) G=(\mathbf{V},w) G=(V,w), where V \mathbf{V} V is the set of nodes,and w : V × V → R w:\mathbf{V}\times\mathbf{V}\to \mathbb{R} w:V×V→R is the weight function where w ( v i , v j ) w(v_i,v_j) w(vi,vj) is the weight of the arc ( v i , v j ) ( v_i, v_j ) (vi,vj),and ( v i , v j ) ∈ V × V (v_i,v_j)\in\mathbf{V}\times\mathbf{V} (vi,vj)∈V×V iff ( v j , v i ) ∈ V × V . (v_j,v_i)\in\mathbf{V}\times\mathbf{V}. (vj,vi)∈V×V. -
画一棵树,将其元组各部分写出来(特别是函数 p p p).
G
=
(
V
,
r
,
p
)
G=(\mathbf{V},r,p)
G=(V,r,p)
V
=
{
v
1
,
…
,
v
6
}
V=\{v_1,\dots,v_6\}
V={v1,…,v6}
r
=
v
1
r=v_1
r=v1
4. 针对该树,将代码中的变量值写出来(特别是parent数组).
public class Tree {
/**
* 节点数. 表示节点 v_0 至 v_{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
n=5;
parent={-1,1,1,2,2,3}
- 画一棵三叉树, 并写出它的 child 数组.
child 数组:
E
=
[
2
3
−
1
4
5
6
−
1
−
1
−
1
−
1
−
1
−
1
−
1
−
1
−
1
−
1
−
1
−
1
]
\mathbf{E}=\begin{bmatrix} 2 & 3 & -1\\ 4 & 5 &6 \\-1 & -1& -1\\-1 & -1 & -1\\-1 & -1& -1\\-1 & -1 & -1\end{bmatrix}
E=⎣⎢⎢⎢⎢⎢⎢⎡24−1−1−1−135−1−1−1−1−16−1−1−1−1⎦⎥⎥⎥⎥⎥⎥⎤
- 按照本贴风格, 重新定义树. 提示: 还是应该定义 parent 函数, 字母表里面只有一个元素.
Let ϕ \phi ϕ be the empty node, a tree is a quadruple T = ( V , Σ , r , p ) T=(\mathbf{V},\Sigma,r,p) T=(V,Σ,r,p),where
- V \mathbf{V} V is the set of nodes;
- Σ \Sigma Σ is the alphabet;
- r ∈ V r\in\mathbf{V} r∈V is the root node;
-
p
:
(
V
∪
{
ϕ
}
)
×
Σ
∗
→
V
∪
{
ϕ
}
p:(\mathbf{V}\cup\{\phi\})\times\Sigma^*\to\mathbf{V}\cup\{\phi\}
p:(V∪{ϕ})×Σ∗→V∪{ϕ} satisfying
- ∀ v ∈ V , ∃ 1 s ∈ Σ ∗ s t . p ( r , s ) = v . \forall{v}\in\mathbf{V},\exist1s\in\Sigma^*st.p(r,s)=v. ∀v∈V,∃1s∈Σ∗st.p(r,s)=v.
- 根据图、树、m mm-叉树的学习, 谈谈你对元组的理解.
描述用不同属性组合成的某一定义的关系。
-
写出本例中的 U , C , D 和 V \mathbf{U}, \mathbf{C}, \mathbf{D} 和 \mathbf{V} U,C,D和V. 注: 最后两个属性为决策属性.
U = { x 1 , x 2 , x 3 , x 4 , x 5 , x 6 , x 7 } \mathbf{U}=\{x_1,x_2,x_3,x_4,x_5,x_6,x_7\} U={x1,x2,x3,x4,x5,x6,x7}.
C = \mathbf{C}= C= { \{ {Headache,Tempersture,Lymphocyte,Leukocyte,Eosinophil } . \}. }.
D = \mathbf{D}= D= { \{ {Heartbeat,flu } . \}. }.
V = \mathbf{V}= V= { \{ {Normal,Abnormal,Yes,No } . \}. }. -
定义一个标签分布系统, 即各标签的值不是 0/1, 而是 [0, 1] 区间的实数, 且同一对象的标签和为 1.
Definition 2. A multi-label decision 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,and ∑ r = 1 l y i r = 1 , n \sum^l_{r=1}y_{ir}=1,n ∑r=1lyir=1,n is the number of instances,and m m m is the number of features,and l l l is the number of labels.