原文地址:机器学习的数学基础1:集合、关系、元组_minfanphd的博客-CSDN博客
本贴主要回答了关于上文中所提出的一系列问题。
习题 1.1: {0,1,{0,1},{1,2}}有几个元素?机器学习中,这类形式的集合有什么优点和缺点?
该集合一共有0,1,{0,1},{1,2}四个元素。
优点:所包含数据的数据类型可多种。
缺点:由于数据类型不同,或者数据维度不同,不能进行统一化处理。
习题 1.2:∅ 的基数是多少? { ∅ } 呢?
∅表示空集,它的基数为0。
{ ∅ }表示一个由空集组成的集合,它的基数为1。
习题 1.3:多标签学习中,输出为一个向量,相应的学习器算不算函数呢?
在数学领域,函数是一种关系,这种关系使一个集合里的每一个元素对应到另一个(可能相同的)集合里的唯一元素。
根据多标签学习的定义,它的输入和输出都存在着一一对应关系。故我认为学习器算作是函数。
(图片来源https://blog.csdn.net/weixin_41108334)
习题 1.4:元组只能表达对象的数据部分, 还是可以完整地表达 (既包括数据, 也包括方法/函数)? 用一个具体的程序来说明。
我认为可以完整地表达。因为从面向程序设计角度来看,元组就是一个类。
那么,我们可以在python如此定义:
class stu:
def __init__(self):
self.id = 1
self.name = 'lihua'
self.sex = 'male'
self.height = 170
def printname(self):
print(self.name)
创建实例后,调用其方法:
eg = stu()
eg.printname()
最后得到:
lihua
习题 1.6:定义带权无向图。
A weighted undirected graph is a tuple \(G_w = (\mathbf{V},w)\), where \(\mathbf{V} = \lbrace v_1,...,v_n\rbrace\) is the set of nodes, \(w :\mathbf{V} \times \mathbf{V} \rightarrow \Bbb{R^+}\cup\lbrace0\rbrace\) is the edge weight function, and \(w(v_i,v_j) = w(v_j,v_i)\).
习题 1.7:定义二叉树。
未完成,这里采用闵老板给出的定义。
Let \(\Sigma =\lbrace r \rbrace\) be the alphbet and \(\phi\) be a null node. A binary tree is a triple \(T = (\mathbf{V},r,c)\), where \(\mathbf{V}=\lbrace v_1,...,v_n\rbrace\) is the set of nodes, \(r \in \mathbf{V}\) is the root, and \(c:\mathbf{V} \cup \lbrace\phi\rbrace \times \Sigma^* \rightarrow \mathbf{V} \cup \lbrace\phi\rbrace\) satisfying.
\(\forall v \in \mathbf{V}, \ \exists 1 s \cup \Sigma^* \) st.\(c(r,s)=v\).
习题 9:考虑 \( \phi\), 重新写 Definition 7 以解决其存在的问题, 见其讨论 d).
A tree is a triple \(T =(\mathbf{V},r,p)\), where \(\mathbf{V}=\lbrace v_1,...,v_n\rbrace\) is the set of nodes, \(r \in \mathbf{V}\) is the root, and \(p:\mathbf{V}\backslash \lbrace r\rbrace \cup\lbrace\phi\rbrace\rightarrow \mathbf{V}\cup\lbrace\phi\rbrace\) is the parent function satisfying.
a)\(\forall k \geq 1,\ p^k(v) \neq v\), and
b)\(\forall v \in \mathbf{V} \backslash \lbrace r\rbrace, \exists 1 k \geq 1\),st.\(p^k(v) = r \), and
c)\(p(\phi)=\phi\)
习题 3.1:模仿自动机的样子来重新定义二叉树。
A binary tree is a 5-tuple \(B=(\Sigma,V,r,\phi,c)\) where
a)\(\Sigma\) is the alphbet, and \(\Sigma=\lbrace l,r\rbrace\);
b)\(V\) is the set of states,\(V=(v_1,...,v_n)\cup\lbrace {\phi}\rbrace\);
c)\(r \in V\) is the start state;
d)\(\phi \in V\) is the terminal state;
e)\(c:V \times \Sigma^* \rightarrow V\) is the transition function.
习题 3.2: 模仿自动机的样子来重新定义树。
A tree is a 5-tuple \(T=(\Sigma,V,r,\phi,p)\) where
a)\(\Sigma\) is the alphbet, and \(\Sigma=N\);
b)\(V\) is the set of states,\(V=(v_1,...,v_n)\cup \lbrace{\phi}\rbrace\);
c)\(r \in V\) is the start state;
d)\(\phi \in V\) is the terminal state;
e)\(p:V\backslash \lbrace r\rbrace \rightarrow V\) is the parent function satisfying.
eg:there is a equation \(v_i=p^n(v_j)\), and \(n \in \Sigma\),which means \(v_i\) is the parent node or the ancestor node of \(v_j\).