1.集合
1.1 集合的定义
集合:是由指定范围内的满足给定条件的所有对象聚集在一起构成,每一个对象称为这个集合的元素。
例如:
A={1,2,3,4},描述了由1,2,3,4四个元素构成的集合A。
· 其中集合与元素的顺序无关。
· 集合中的元素是互异的,若一个集合中有多个相同元素则只能算作一个。
习题 1: { 0 , 1 , { 0 , 1 } , { 1 , 2 } }有几个元素? 机器学习中, 这类形式的集合有什么优点和缺点?
集合中各个元素通过逗号分隔,由此可见上题集合中有四个元素。
优点:有利于多标签学习
缺点:因其集合中的元素类别等不同,处理时会复杂一些。
1.2 基数
集合A中元素的个数,就是集合的基数,也称为集合的势,记作|A|。
习题 2: ∅ 的基数是多少? { ∅ }呢?
∅表示空集,即基数为零;{ ∅ }表示此集合中只有 ∅一个基数。
1.3 笛卡尔积
· 有序对:有两个元素x和y按一定顺序排列成的二元组叫做有序对或有序偶,记作<x,y>。称x,y分别为序偶的第一,第二元素。
· 笛卡尔积:设A,B为集合,用A中元素为第一元素,B中元素为第二元素构成有序对。所有这样的有序对组成的集合叫做A和B的笛卡尔积,记作AxB,表示为AxB={<x,y>|x∈A^y∈B}。
· 定理 :若A,B都是有限集,且|A|=m,|B|=n,则|AxB|=|A|x|B|=mxn。
· 性质 :笛卡尔积不满足交换律和结合律,对并和交运算满足分配率。
· 关系的表示 :
三种方式:列举法,矩阵法,关系图法。
1.4 幂集
Definition 2. The power set of Ais given by
= { B ∣ B ⊆ A } .
所谓幂集,就是原集合A中所有的子集(包括全集和空集)构成的集族。
例:A={1,2,3}, 2 ^A ={∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}.
2. 二元关系
Definition 3. Let A and B be two sets. Any R ⊆ A × B is a binray relation.
3. 函数
Definition 4. Let V 1 , … , V m be the domain of conditional attribute a 1 , … , am, respectively, and L be the set of classes. A classifier is a function f : V 1 × ⋯ × V m → L .
·函数是特殊的关系,它满足:
函数的定义域是domf=X,而不能是domf的某个真子集。
若<x,y>∈f,<x,y'>∈f,则y=y'(单值性)
·特别的:对空关系∅⊆AxB,
如果A=∅,空关系∅是函数
如果A≠∅,空关系∅不是函数
习题5:多标签学习中,输出为一个向量,相应的学习器算不算函数呢?
首先回答是肯定的。输入一个数据,通过映射得到相应的输出数据,虽然输出为一个向量,但是在机器学习里,其本身就是寻找一个个函数,通过函数和输入得到输出,所以相应的学习器算是一个函数。
4.元组
元组(tuple)是关系数据库中的基本概念,关系是一张表,表中的每行(即数据库中的每条记录)就是一个元组,每列就是一个属性,
其中图是最经典的元组,下面分别是有向图、无向图以及带权图的定义
Definition 5. A directed graph is a tuple
= ( V , E ), where V = {
, … ,
}is the set of nodes, and E ⊆ V × V is the set of edges,
Definition 6. An undirected graph is a tuple
= ( V , E ) , where V = {
, … ,
}is the set of nodes, E ⊆ V × V is the set of edges, and 〈 v i , v j 〉 ∈ E iff 〈 v j , v i 〉 ∈ E .
Definition 7. A weighted directed graph is a tuple
= ( V , w ), where V = {
, … ,
} is the set of nodes, and w : V × V →
∪ { 0 } is the edge weight function.
习题6:元组只能表达对象的数据部分, 还是可以完整地表达 (既包括数据, 也包括方法/函数)? 用一个具体的程序来说明.
答案是可以完整表达。列子如下:
tup1 = ('computer', 'math', 11, 12)
tup2 = (1, 2)
tup3 = ('cm',tup1,tup2)
print("tup3: ",tup3)
print("tup1[0]: ", tup1[0])
tup3: ('cm', ('computer', 'math', 11, 12), (1, 2))
tup1[0]: computer
[Finished in 0.1s]
习题 7: 定义二叉树.
Let be the alphbet and
be a null node.Abinary tree is a triple
,where
is the set of nodes,
is the root,and c:
satisfying
a)st.c(v,s)=v;
b),
习题 8: 定义带权无向图.
A weigheed undirected graph is a tuple ,where
is the set of nodes,and
is theedge weight function satisfying
习题9:重新考虑
,重新写Definition6 以解决其存在的问题,捡起讨论d)
A tree is a triple and ∅ be a null node,where
is the set of nodes,r∈V is the root,and p:
is the parent function satisfying
a),
b),
确定的有穷状态的自动机定义如下:
A deterministic finite state automata (DFA) is a 5-tuple ,where
a) is the alphabet;
b)Q is the set of states;
c)is the start state;
d) is the set of the terminal states;
e)f: is the transition function.
Any is accepted by automata iff
习题 3.1 模仿自动机的样子来重新定义二叉树.
A binary tree is a 5-tuple ,where
a) is the alphabet;
b) is the set of states,where V is the set of node and ∅ isthe null node;
c) is the root or start state;
d) is the set of terminal state;
e)f: is the transition function.
Any is accepted by automata iff
习题3.2 模仿自动机的样子来重新定义树.
A tree is a 5-tuple ,where
a) is the alphabet;
b)V is the set of nodes;
c) is the root;
d)p is the parent;
e)f: is the transition function.
Any is accepted by automata iff
这篇博客介绍了离散数学的基础概念,包括集合的定义、基数、笛卡尔积和幂集。此外,还讨论了二元关系、函数的性质,以及元组在数据表示中的应用。通过对集合理论的理解,有助于深化对机器学习中多标签学习和数据结构的认识。
1299

被折叠的 条评论
为什么被折叠?



