文章目录
1 集合1.1 集合的表示方法1. 2 常用的集合1.3 元素与子集1.4 集合运算
2 簇3 向量4 矩阵
1 集合
1.1 集合的表示方法
类型符号表示举例文字说明枚举法1)
A
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
}
\mathbf{A} = \{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9\}
A={0,1,2,3,4,5,6,7,8,9}是阿拉伯数字的集合
2
)
N
=
{
0
,
1
,
2
,
…
,
}
2) \mathbf{N} = \{0, 1, 2, \dots,\}
2)N={0,1,2,…,}是自然数的集合
3
)
Ω
=
{
a
,
b
,
…
,
z
}
3) \mathbf{\Omega} = \{\textrm{a}, \textrm{b}, \dots, \textrm{z}\}
3)Ω={a,b,…,z}是英文字母表1) \mathbf{A} = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}2) \mathbf{N} = {0, 1, 2, \dots,}3) mathbf{\Omega} = {\textrm{a}, \textrm{b}, \dots, \textrm{z}}易错的三个坑:1) 逗号前无空格,逗号后有空格; 2) 集合要用加粗; 3) 集合用{ },且元素无序枚举的简记法1) 两个整数间的枚举集合:
[
1..10
]
=
{
1
,
2
,
…
,
10
}
[1 ..10] = \{1, 2, \dots, 10\}
[1..10]={1,2,…,10}2) 区间:(3, 5)[3,5) … 3)
X
=
{
x
i
}
i
=
1
n
=
{
x
1
,
…
,
x
n
}
\mathbf{X} = \{ x_i\}_{i=1}^n = \{ x_1, \dots, x_n\}
X={xi}i=1n={x1,…,xn}1) [1. .10] = {1, 2, \dots, 10}2)(3, 5)[3,5)3) \mathbf{X} = { x_i}_{i=1}^n = {x_1, \dots, x_n}谓词法奇数的集合:
O
=
{
x
∣
x
∈
N
,
x
m
o
d
2
=
1
}
\mathbf{O} = \{ x \vert x \in \mathbf{N}, x \mod 2 = 1\}
O={x∣x∈N,xmod2=1} 或
O
=
{
x
∈
N
∣
x
m
o
d
2
=
1
}
\mathbf{O} = \{ x \in \mathbf{N} \vert x \mod 2 = 1\}
O={x∈N∣xmod2=1}1) mathbf{O} = { x \vert x \in \mathbf{N}, x \mod 2 = 1} 2) \mathbf{O} = { x \in \mathbf{N} \vert x \mod 2 = 1}第2种写法,通常把基本的限制写在左边,但是只能写一个条件
1. 2 常用的集合
类型符号文字说明实数
R
(
常
用
,
推
荐
)
\mathbb{R}(常用,推荐)
R(常用,推荐)
R
\mathcal{R}
R(可以接受)\mathbb{R}\mathcal{R}
R
\mathbb{R}
R是实数专用,不能另做他用空集
∅
\emptyset
∅\emptyset
ϕ
\phi
ϕ(\phi)是错误的表达全集
U
\mathbf{U}
U\mathbf{U}
1.3 元素与子集
类型符号文字说明元素
x
∈
X
x \in \mathbf{X}
x∈Xx \in \mathbf{X}元素
x
x
x与集合
X
\mathbf{X}
X的关系子集
A
⊂
B
\mathbf{A} \subset \mathbf{B}
A⊂B\mathbf{A} \subset \mathbf{B}集合A与集合B的关系子集
A
⊆
B
\mathbf{A} \subseteq \mathbf{B}
A⊆B\mathbf{A} \subseteq \mathbf{B}集合A与集合B的关系
1.4 集合运算
运算类型符号文字说明基
∣
X
∣
\vert \mathbf{X} \vert
∣X∣\vert \mathbf{X} \vert集合
X
\mathbf{X}
X中元素的个数
∣
∅
∣
=
0
\vert \emptyset \vert = 0
∣∅∣=0并1)
X
∪
Y
\mathbf{X} \cup \mathbf{Y}
X∪Y 2)
⋃
i
=
1
n
X
i
\bigcup_{i=1}^n \mathbf{X}_i
⋃i=1nXi1) \mathbf{X} \cup \mathbf{Y} 2) \bigcup_{i=1}^n \mathbf{X}_i1) 两个集合并 2) n个集合并交1)
X
∩
Y
\mathbf{X} \cap \mathbf{Y}
X∩Y 2)
⋂
i
=
1
n
X
i
\bigcap_{i=1}^n \mathbf{X}_i
⋂i=1nXi1) \mathbf{X} \cap \mathbf{Y} 2) \bigcap_{i=1}^n \mathbf{X}_i1) 两个集合并交 2) n个集合交差
X
∖
Y
\mathbf{X} \setminus \mathbf{Y}
X∖Y\mathbf{X} \setminus \mathbf{Y}两个集合差补
X
‾
=
U
∖
X
\overline{\mathbf{X}} = \mathbf{U} \setminus \mathbf{X}
X=U∖X\overline{\mathbf{X}} = \mathbf{U} \setminus \mathbf{X}全集
U
\mathbf{U}
U 有人用
¬
X
\neg \mathbf{X}
¬X 可以接受,但不建议幂集
2
A
=
{
B
∣
B
⊆
A
}
2^\mathbf{A} = \{ \mathbf{B} \vert \mathbf{B} \subseteq \mathbf{A}\}
2A={B∣B⊆A}2^\mathbf{A} = { \mathbf{B} \vert \mathbf{B} \subseteq \mathbf{A}}例如:
A
=
{
0
,
1
,
2
}
\mathbf{A} = \{0, 1, 2\}
A={0,1,2},则:1)
2
A
=
{
∅
,
{
0
}
,
{
1
}
,
{
2
}
,
{
0
,
1
}
,
{
0
,
2
}
,
{
1
,
2
}
,
{
0
,
1
,
2
}
}
2^\mathbf{A} = \{\emptyset, \{0\}, \{1\}, \{2\}, \{0, 1\}, \{0, 2\}, \{1, 2\}, \{0, 1, 2\}\}
2A={∅,{0},{1},{2},{0,1},{0,2},{1,2},{0,1,2}}2)
∣
2
A
∣
=
2
∣
A
∣
=
2
3
=
8
\vert 2^\mathbf{A} \vert = 2 ^{\vert \mathbf{A}}\vert = 2^3 = 8
∣2A∣=2∣A∣=23=8 3)
B
⊆
A
\mathbf{B} \subseteq \mathbf{A}
B⊆A 与
B
∈
2
A
\mathbf{B} \in 2^\mathbf{A}
B∈2A等价笛卡尔积
A
×
B
=
{
(
a
,
b
)
∣
a
∈
A
,
b
∈
B
}
\mathbf{A} \times \mathbf{B} = \{(a, b) \vert a \in \mathbf{A}, b \in \mathbf{B}\}
A×B={(a,b)∣a∈A,b∈B}\mathbf{A} \times \mathbf{B} = {(a, b) \vert a \in \mathbf{A}, b \in \mathbf{B}}
A
\mathbf{A}
A和
B
\mathbf{B}
B各出一个元素,组成一个新的元素对
(
a
,
b
)
≠
(
b
,
a
)
(a, b) \neq (b, a)
(a,b)=(b,a),所以
A
×
B
≠
B
×
A
\mathbf{A} \times \mathbf{B} \neq \mathbf{B} \times \mathbf{A}
A×B=B×A 对于有穷集合:
∣
A
×
B
∣
=
∣
A
∣
×
∣
B
∣
\vert \mathbf{A} \times \mathbf{B} \vert = \vert \mathbf{A}\vert \times \vert \mathbf{B} \vert
∣A×B∣=∣A∣×∣B∣
2 簇
集合的集合称为簇,一般用\mathcal符号表示
运算类型符号文字说明簇
B
=
{
B
1
,
…
,
B
N
}
\mathcal{B} = \{ \mathbf{B}_1, \dots, \mathbf{B}_N\}
B={B1,…,BN}, where
B
i
=
{
x
i
1
,
…
,
x
i
j
}
\mathbf{B}_i=\{ \mathbf{x}_{i1}, \dots, \mathbf{x}_{ij}\}
Bi={xi1,…,xij}\mathcal{B} = { \mathbf{B}_1, \dots, \mathbf{B}N}, \mathbf{B}i={ \mathbf{x}{i1}, \dots, \mathbf{x}{ij}}即
x
i
j
\mathbf{x}_{ij}
xij是
B
i
\mathbf{B}_i
Bi中的一个向量,
B
i
\mathbf{B}_i
Bi是向量的集合,而
B
\mathcal{B}
B是
B
i
\mathbf{B}_i
Bi的集合簇的并运算
∪
B
=
∪
{
B
1
,
…
,
B
N
}
=
⋃
i
=
1
N
{
B
i
}
=
B
1
∪
B
2
∪
⋯
∪
B
N
\cup \mathcal{B} =\cup \{ \mathbf{B}_1, \dots, \mathbf{B}_N\} =\bigcup_{i=1}^N\{B_i\} = \mathbf{B}_1\cup \mathbf{B}_2\cup\dots\cup \mathbf{B}_N
∪B=∪{B1,…,BN}=⋃i=1N{Bi}=B1∪B2∪⋯∪BN\cup \mathcal{B} =\cup { \mathbf{B}_1, \dots, \mathbf{B}N} =\bigcup{i=1}^N{B_i} = \mathbf{B}_1\cup \mathbf{B}_2\cup\dots\cup \mathbf{B}_N即进行“解簇”运算,让所有集合并成了一个集合。
例1:
上式描述,
x
i
j
\mathbf{x}_{ij}
xij属于标签为正的包
B
i
\mathbf{B}_i
Bi, 但是谓词法(\vert)标准用法是用于集合。 但如果这里加上括号,即:
x
i
j
∈
{
B
i
∣
y
i
=
+
1
}
\mathbf{x}_{ij} \in \{\mathbf{B}_i \vert y_i=+1\}
xij∈{Bi∣yi=+1},那么一个向量
x
i
j
\mathbf{x}_{ij}
xij属于一个簇,则是不对的。 解决:
x
i
j
∈
∪
{
B
i
∣
y
i
=
+
1
}
\mathbf{x}_{ij} \in \cup\{\mathbf{B}_i \vert y_i=+1\}
xij∈∪{Bi∣yi=+1},这样就可以啦。
例2:
上式想表示
X
1
∗
\mathbf{X}_1^*
X1∗是一个
B
i
\mathbf{B}_i
Bi的一个并集,并且
B
i
\mathbf{B}_i
Bi是标签为-1的包,且属于
B
\mathcal{B}
B。 但是,\vert这种表示,都是集合的谓词描述方法,那么,上式可以改写为:
X
1
∗
=
⋃
{
B
i
∈
B
∣
y
i
=
−
1
}
\mathbf{X}_1^*=\bigcup \{\mathbf{B}_i \in \mathcal{B}\vert y_i=-1\}
X1∗=⋃{Bi∈B∣yi=−1}
3 向量
表示向量用( )或 [ ] ; 向量通常用小写加粗符号,如: \mathbf{x} \bm{x} \boldsymbol{x}
类型符号表示文字说明列向量1)
x
∈
R
m
\mathbf{x} \in \mathbb{R}^m
x∈Rm 2)
x
=
(
x
1
;
x
2
;
…
;
x
n
)
\mathbf{x} = (x_1; x_2; \dots; x_n)
x=(x1;x2;…;xn),
x
i
∈
R
x_i \in \mathbb{R}
xi∈R1) \mathbf{x} \in \mathbb{R}^m2) \mathbf{x} = ( x_1; x_2; \dots; x_n)m*1维空间的一个点行向量1)
x
∈
R
1
∗
m
\mathbf{x} \in \mathbb{R}^{1*m}
x∈R1∗m2)
x
=
(
x
1
,
x
2
,
…
,
x
n
)
\mathbf{x} = ( x_1, x_2, \dots, x_n)
x=(x1,x2,…,xn),
x
i
∈
R
x_i \in \mathbb{R}
xi∈R1) \mathbf{x} \in \mathbb{R}^{1*m}2) \mathbf{x} = ( x_1, x_2, \dots, x_n)1*m维空间的一个点转置
x
=
(
x
1
,
x
2
,
…
,
x
n
)
\mathbf{x} = ( x_1, x_2, \dots, x_n)
x=(x1,x2,…,xn),则
x
T
=
(
x
1
;
x
2
;
…
;
x
n
)
\mathbf{x}^{\mathrm{T}} = ( x_1; x_2; \dots; x_n)
xT=(x1;x2;…;xn)\mathbf{x}^{\mathrm{T}} = ( x_1; x_2; \dots; x_n)内积(点积)
a
⋅
b
=
a
b
T
=
∑
i
=
1
n
a
i
b
i
\mathbf{a} \cdot \mathbf{b} = \mathbf{a}\mathbf{b}^\mathrm{T} = \sum_{i=1}^n a_ib_i
a⋅b=abT=∑i=1naibi\mathbf{a} \cdot \mathbf{b} = \mathbf{a}\mathbf{b}^\mathrm{T} = \sum_{i=1}^n a_ib_i机器学习里面,常用于求向量的加权和:
x
⋅
w
=
x
w
T
=
∑
i
=
1
n
x
i
w
i
\mathbf{x} \cdot \mathbf{w} = \mathbf{x}\mathbf{w}^\mathrm{T} = \sum_{i=1}^n x_iw_i
x⋅w=xwT=∑i=1nxiwi
4 矩阵
类型符号表示文字说明m行n列的矩阵1)
X
∈
R
m
×
n
\mathbf{X} \in \mathbb{R}^{m \times n}
X∈Rm×n 2)
X
=
[
x
i
j
]
m
×
n
\mathbf{X} = [x_{ij}]_{m \times n}
X=[xij]m×n,
x
i
j
∈
R
x_{ij} \in \mathbb{R}
xij∈R1) \mathbf{X} \in \mathbb{R}^{m \times n}2) \mathbf{X} = [x_{ij}]_{m \times n}
m
×
n
m \times n
m×n 维空间的一个点机器学习的特殊表示
X
=
{
x
i
}
i
=
1
m
=
{
x
1
,
x
2
,
…
,
x
m
}
.
\mathbf{X} = \{ \mathbf{x}_i\}_{i=1}^m = \{ \mathbf{x}_1, \mathbf{x}_2, \dots, \mathbf{x}_m\}.
X={xi}i=1m={x1,x2,…,xm}.其中,
x
i
=
(
x
i
1
,
x
i
2
,
…
,
x
i
n
)
\mathbf{x}_i = ( x_{i1}, x_{i2}, \dots, x_{in})
xi=(xi1,xi2,…,xin)描述的是,
X
\mathbf{X}
X包括m个实例,每个示例用n个属性表示。
X
\mathbf{X}
X是集合,后者是向量。好处:方便表示实例和特征值的关系缺点:
X
\mathbf{X}
X不能参与矩阵运算若实在需要,只能适当牺牲严谨性,做一些说明,如:in the following context, $\mathbf{X} is alos treated as
[
x
1
,
x
2
,
…
,
x
n
]
T
[\mathbf{x}_1, \mathbf{x}_2, \dots, \mathbf{x}_n]^\mathrm{T}
[x1,x2,…,xn]T to surpport matrix operations.