离散数学入门级概念:集合、关系、元组
习题 1.1 : { 0 , 1 , { 0 , 1 } , { 1 , 2 } } 有几个元素? 机器学习中, 这类形式的集合有什么优点和缺点?
答:有4个元素,分别是0,1, { 0 , 1 } 和 { 1 , 2 }。
优点:含有不同类别的元素,多于处理多个标签的分类较为方便。
缺点:可以从多个维度下访问到数据。数据访问较易发生错误,特别是数据量大的情况下。
习题 1.2: ∅ 的基数是多少? { ∅ } 呢?
答:∅的基数为0,表示空集。 { ∅ }的基数为1,表示有一个元素且该元素为空集。
习题1.3 : 多标签学习中, 输出为一个向量,相应的学习器算不算函数呢?
答:相应的学习器算函数。函数中很关键的一点为一个自变量只能对应一个因变量。多标签学习中自变量为输入样本,因变量为标签向量。假如总共有:1,2,3这3种标签,则输出可能是
{{},{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}},即定义域如此。一个输入样本对应的输出只可能是这个集合中的一种元素,输出不可能既是一种元素又是另一种元素。所以我认为它是函数。
习题 1.4: 元组只能表达对象的数据部分, 还是可以完整地表达 (既包括数据, 也包括方法/函数)? 用一个具体的程序来说明.
答:元组可以完整的表达。
习题 1.5: 定义二叉树.
答:Definition:A Btree is a tuple = (
,
,
,
) ,where
= {
, … ,
} is the set of nodes, r ∈
is the root,
:
∖{
} →
is the parent function satisfying,and
is the set of records that a node looks for root by p.
a) ∀ k ≥ 1 , (
) ≠
,and
b) ∀ ∈
∖ {
} , ∃1 k ≥ 1 , st.
(
) =
,and
c) ∀ ∈
∖ {
} , ∃1
∈
∖ {
,
} , st.
(
) =
(
) U ∀
∈
∖ {
} , ∀
∈
∖ {
,
} , st.
(
) !=
(
) and
d) ∀ ∈
∖ {
}, ∃1
∈
,st.
(
) =
.
习题1.6: 定义带权无向图.
答:Definition:A weighted undirected graph is a tuple = (
,
,
) ,where
= {
, … ,
}is the set of nodes,
⊆
×
is the set of edges, and 〈
,
〉 ∈ E iff 〈
,
〉 ∈ E,
:
→
∪ { 0 } is the edge weight function.
习题 9. 考虑 ϕ, 重新写 Definition 7 以解决其存在的问题, 见其讨论 d).
答:Definition : Let Σ = {,
} be the alphbet and ϕ be a null node. A binary tree is a triple
= (
,
,
) , where
= {
, … ,
} is the set of nodes,
∈
is the root,
and :
∪ { ϕ } × Σ ∗ →
∪ { ϕ } satisfying.
∀ ∈
, ∃ 1
∈ Σ ∗ st.
(
,
)=
.
a) = {
} ,
(
,
) = c (
,
) = ϕ ,
( ϕ ,
) =
( ϕ ,
) = ϕ .
c) (
, ε ) = r . 即从 r 读入空串到自己.
习题 3.1 模仿自动机的样子来重新定义二叉树.
答:Definition: Let Σ = { l , r } be the alphbet and ϕ be a null node. A Btree is a tuple = (
,
,
,
) ,where
is the set of states,
∈
is the start state,
⊆Q is the set of terminal states,
:
×Σ∗→
is the transition function.
a) ∈ Σ is accepted by the automata;∃1
∈
, iff
(
, s ) ∈
.
b) ∀∈
,st. ∃1
(
, Σ)∈
.
c)∀∈
, ∃ t∈
=ϕ.
d) ∀∈
/ϕ, ∃1 q
∈
.
e)∀=ϕ,∃1 q
=
=ϕ.
习题3.2 模仿自动机的样子来重新定义树.
Definition: A tree is a tuple = (
,
,
,
) ,where
is the set of states,
∈
is the start state,
⊆Q is the set of terminal states,
:
×Σ∗→
is the transition function.
a) ∈ Σ is accepted by the automata;∃1
∈
, iff
(
, s ) ∈
.
b)∀∈
, ∃ t∈
=ϕ.
c) ∀∈
/ϕ, ∃ q
∈
.
d)∀=ϕ,∃1 q
=
=ϕ.