第四次作业

1.定义无向网络.
An 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×VR 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).
2.写出该无向图的邻接矩阵.
在这里插入图片描述

X = [ 0 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0 ] \mathbf{X}=\begin{bmatrix} 0 & 1 & 1 & 1\\ 1 & 0 & 1 & 0 \\ 1 & 1 & 0 & 1\\ 1 & 0 & 1 & 0 \end{bmatrix} X=0111101011011010
3. 自 己 画 一 棵 树 , 将 其 元 组 各 部 分 写 出 来 ( 特 别 是 函 数 p ) 自己画一棵树, 将其元组各部分写出来 (特别是函数p) ,(p)
在这里插入图片描述

V = { v 1 , v 2 , v 3 , v 4 , v 5 , v 0 } \mathbf{V}=\{\textrm v_1,\textrm v_2,\textrm v_3,\textrm v_4,\textrm v_5,\textrm v_0\} V={v1,v2,v3,v4,v5,v0}
r = { v 0 } \mathbf{r} = \{\textrm v_0\} r={v0}
p ( 0 ) ( v 3 ) ≡ v 3 p^{(0)}(\textrm v_3) \equiv \textrm v_3 p(0)(v3)v3
p ( 1 ) ( v 3 ) = v 1 p^{(1)}(\textrm v_3) = \textrm v_1 p(1)(v3)=v1
p ( 2 ) ( v 3 ) = v 0 p^{(2)}(\textrm v_3) = \textrm v_0 p(2)(v3)=v0
p ( 0 ) ( v 4 ) ≡ v 4 p^{(0)}(\textrm v_4) \equiv \textrm v_4 p(0)(v4)v4
p ( 1 ) ( v 4 ) = v 1 p^{(1)}(\textrm v_4) = \textrm v_1 p(1)(v4)=v1
p ( 2 ) ( v 4 ) = v 0 p^{(2)}(\textrm v_4) = \textrm v_0 p(2)(v4)=v0
p ( 0 ) ( v 5 ) ≡ v 5 p^{(0)}(\textrm v_5) \equiv \textrm v_5 p(0)(v5)v5
p ( 1 ) ( v 5 ) = v 2 p^{(1)}(\textrm v_5) = \textrm v_2 p(1)(v5)=v2
p ( 2 ) ( v 5 ) = v 0 p^{(2)}(\textrm v_5) = \textrm v_0 p(2)(v5)=v0
p ( 0 ) ( v 1 ) ≡ v 1 p^{(0)}(\textrm v_1) \equiv \textrm v_1 p(0)(v1)v1
p ( 1 ) ( v 1 ) = v 0 p^{(1)}(\textrm v_1) = \textrm v_0 p(1)(v1)=v0
p ( 0 ) ( v 2 ) ≡ v 2 p^{(0)}(\textrm v_2) \equiv \textrm v_2 p(0)(v2)v2
p ( 1 ) ( v 2 ) = v 0 p^{(1)}(\textrm v_2) = \textrm v_0 p(1)(v2)=v0
p ( 0 ) ( v 0 ) ≡ v 0 p^{(0)}(\textrm v_0) \equiv \textrm v_0 p(0)(v0)v0
针对该树, 将代码中的变量值写出来 (特别是 parent 数组).
n = 6 \mathrm n = 6 n=6
r = 0 \mathrm r = 0 r=0
p a r e n t [ 0 ] = − 1 \mathrm {parent[0]} = -1 parent[0]=1
p a r e n t [ 1 ] = 0 \mathrm {parent[1]} = 0 parent[1]=0
p a r e n t [ 2 ] = 0 \mathrm {parent[2]} = 0 parent[2]=0
p a r e n t [ 3 ] = 1 \mathrm {parent[3]} = 1 parent[3]=1
p a r e n t [ 4 ] = 1 \mathrm {parent[4]} = 1 parent[4]=1
p a r e n t [ 5 ] = 2 \mathrm {parent[5]} = 2 parent[5]=2
画一棵三叉树, 并写出它的 child 数组.
在这里插入图片描述
c h i l d [ 1 ] = { 2 , 3 , 4 } \mathrm {child[1]} =\{2,3,4\} child[1]={2,3,4}
c h i l d [ 2 ] = { − 1 , − 1 , − 1 } \mathrm {child[2]} =\{-1,-1,-1\} child[2]={1,1,1}
c h i l d [ 3 ] = { − 1 , − 1 , − 1 } \mathrm {child[3]} =\{-1,-1,-1\} child[3]={1,1,1}
c h i l d [ 4 ] = { − 1 , − 1 , − 1 } \mathrm {child[4]} =\{-1,-1,-1\} child[4]={1,1,1}
按照本贴风格, 重新定义树. 提示: 还是应该定义 parent 函数, 字母表里面只有一个元素.
Let ϕ \phi ϕ be the empty node, a tree is a quadruple T = ( Σ , V , r , p ) , T = (\Sigma,\mathbf V,r, p) , T=(Σ,V,r,p)where
V \mathbf{V} V is the set of nodes;
r ∈ V r \in \mathbf{V} rV is the root node;
Σ \Sigma Σ is the alphabet;
c c c : ( V ∪ { ϕ } ) × Σ ∗ :(\mathbf{V} \cup \{\phi\}) \times \Sigma^* :(V{ϕ})×Σ V ∪ { ϕ } \mathbf{V} \cup \{\phi\} V{ϕ} satisfying
∀ v ∈ V \forall v \in \mathbf{V} vV, ∃ ! s ∈ Σ ∗ \exists ! s \in \Sigma^* !sΣ st. p ( r , s ) = v p(r,s)=v p(r,s)=v
定义一个标签分布系统, 即各标签的值不是 0/1, 而是 [ 0 , 1 ] \left[0,1\right] [0,1]区间的实数, 且同一对象的标签和为 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×mRn×mis 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×lis the label matrix and ∑ 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值