目录
- 机器学习( M a c h i n e L e a r n i n g Machine Learning MachineLearning, M L ML ML)
- 一,基本术语
-
- 1.数据集( d a t a data data s e t set set) D D D
- 2.标记( l a b e l label label) y y y
- 3.训练( t r a i n i n g training training)
- 4.监督学习( s u p e r v i s e d supervised supervised l e a r n i n g learning learning)
- 5.无监督学习( u n s u p e r v i s e d unsupervised unsupervised l e a r n i n g learning learning)
- 6.归纳学习( i n d u c t i v e inductive inductive l e a r n i n g learning learning)
- 二,模型评估和选择
-
- (一)概念
- (二)评估方法
-
- 1.留出法( h o l d hold hold- o u t out out)
- 2.交叉验证法(cross validation)( k k k折交叉验证法, k k k- f o l d fold fold c r o s s cross cross v a l i d a t i o n validation validation)
- 3.留一法( l e a v e leave leave- o n e one one- o u t out out, L O O LOO LOO)
- 4.自助法( b o o t s t r a p p i n g bootstrapping bootstrapping)
- 5.调参
- (三)性能度量( p e r f o r m a n c e performance performance m e a s u r e measure measure)
- (四)偏差-方差分解( b i a s − v a r i a n c e bias-variance bias−variance d e c o m p o s i t i o n decomposition decomposition)
- (五)比较检验
- 三,归纳学习的分类领域
- 四,机器学习方法
-
- (一)传统机器学习方法
-
- 1.监督学习( s u p e r v i s e d supervised supervised l e a r n i n g learning learning)
-
- (1)线性回归( l i n e a r linear linear r e g r e s s i o n regression regression)
- (2)逻辑回归( l o g i s t i c logistic logistic r e g r e s s i o n regression regression)
- (3)决策树( d e c i s i o n decision decision t r e e tree tree)
- (4)支持向量机( s u p p o r t support support v e c t o r vector vector m a c h i n e machine machine, S V M SVM SVM)
- (5) k k k最近邻( k − n e a r e s t k-nearest k−nearest n e i g h b o r s neighbors neighbors, k − N N k-NN k−NN)
- (6)计算学习( c o m p u t a t i o n a l computational computational l e a r n i n g learning learning)
- (7)规则学习( r u l e rule rule l e a r n i n g learning learning)
- (8)生成式模型( g e n e r a t i v e generative generative m o d e l s models models)
- (9)集成学习( e n s e m b l e ensemble ensemble l e a r n i n g learning learning)
- 2.无监督学习( u n s u p e r v i s e d unsupervised unsupervised l e a r n i n g learning learning)
- 3. 半监督学习( s e m i − s u p e r v i s e d semi-supervised semi−supervised l e a r n i n g learning learning)
-
- (1)自训练( s e l f − t r a i n i n g self-training self−training)
- (2)协同训练( c o − t r a i n i n g co-training co−training)
- (3)标签传播( l a b e l label label p r o p a g a t i o n propagation propagation)
- (4)分布式共享表示( d i s t r i b u t e d distributed distributed s h a r e d shared shared r e p r e s e n t a t i o n s representations representations)
- 4.强化学习( r e i n f o r c e m e n t reinforcement reinforcement l e a r n i n g learning learning)
- 5.迁移学习( t r a n s f e r transfer transfer l e a r n i n g learning learning)
- (二)深度学习
- 五,其他概念
机器学习( M a c h i n e L e a r n i n g Machine Learning MachineLearning, M L ML ML)
机器学习所研究的主要内容:关于在计算机上从数据中产生模型( m o d e l model model)或学习器( l e a r n i n g learning learning)的算法,即学习算法( l e a r n i n g learning learning a l g o r i t h m algorithm algorithm)。
一,基本术语
1.数据集( d a t a data data s e t set set) D D D
D = { x ⃗ 1 , x ⃗ 2 , … , x ⃗ m } D=\left\{\vec{x}_1,\vec{x}_2,…,\vec{x}_m\right\} D={
x1,x2,…,xm}
其中 x ⃗ i \vec{x}_i xi为数据集 D D D的第 i i i个示例( i n s t a n c e instance instance)或样本( s a m p l e sample sample),是关于一个事件或对象的描述
x ⃗ i = ( x i 1 ; x i 2 ; … ; x i d ) \vec{x}_i=(x_{i1};x_{i2};…;x_{id}) xi=(xi1;xi2;…;xid)
其中 d d d为样本 x ⃗ i \vec{x}_i xi的维度( d i m e n s i o n a l i t y dimensionality dimensionality),表示样本有 d d d个属性( a t t r i b u t e attribute attribute)或特征( f e a t u r e feature feature),其反映事件或对象在某方面的表现或性质的事项; x i j x_{ij} xij是 x ⃗ i \vec{x}_i xi在第 j j j个属性上的属性值( a t t r i b u t e attribute attribute v a l u e value value)
属性值构成的空间为属性空间( a t t r i b u t e attribute attribute s p a c e space space)或样本空间( s a m p l e sample sample s p a c e space space)或输入空间 χ \chi χ,可以认为 x ⃗ i \vec{x}_i xi是d维样本空间 χ \chi χ的特征向量( f e a t u r e feature feature v e c t o r vector vector), x ⃗ i ∈ χ \vec{x}_i\in\chi xi∈χ
2.标记( l a b e l label label) y y y
拥有了标记信息的示例,称为样例( e x a m p l e example example); ( x ⃗ i , y i ) (\vec{x}_i,y_i) (xi,yi)表示第 i i i个样例,其中 y i y_i yi为示例 x ⃗ i \vec{x}_i xi的标记;所有标记的集合为标记空间( l a b e l label label s p a c e space space)或输出空间 γ \gamma γ, y i ∈ γ y_i\in\gamma yi∈γ
若将标记看作对象本身的一部分,则“样例”有时也称为“样本”
3.训练( t r a i n i n g training training)
- 训练:从数据中学得模型的过程
- 训练示例( t r a i n train train i n s t a n c e instance instance)或训练样本( t r a i n train train s a m p l e sample sample)
x ⃗ i 或( x ⃗ i , y i ) \vec{x}_i或(\vec{x}_i,y_i) xi或(xi,yi) - 训练(数据)集( t r a i n train train s e t set set):用于训练模型的数据集
{ x ⃗ 1 , x ⃗ 2 , … , x ⃗ m } \left\{\vec{x}_1,\vec{x}_2,…,\vec{x}_m\right\} { x1,x2,…,xm}
或 { ( x ⃗ 1 , y 1 ) , ( x ⃗ 2 , y 2 ) , … , ( x ⃗ m , y m ) } \left\{(\vec{x}_1,y_1),(\vec{x}_2,y_2),…,(\vec{x}_m,y_m)\right\} { (x1,y1),(x2,y2),…,(xm,ym)}
4.监督学习( s u p e r v i s e d supervised supervised l e a r n i n g learning learning)
监督学习是处理拥有标记信息的训练数据的学习任务。
预测( p r e d i c t i o n prediction prediction)任务是希望通过对这种训练集进行学习,建立一个从输入空间 χ \chi χ到输出空间 γ \gamma γ的映射 f f f: χ ↦ γ \chi\mapsto\gamma χ↦γ
- 学习任务——分类( c l a s s i f i c a t i o n classification classification):预测离散值
只有两个标记类别的学习任务为二分类( b i n a r y binary binary c l a s s i f i c a t i o n classification classification),其中一个类为正类( p o s i t i v e positive positive c l a s s class class),另一个类为反类或负类( n e g a t i v e negative negative c l a s s class class);常令 γ = { − 1 , + 1 } \gamma=\left\{ -1,+1\right\} γ={ −1,+1}或 { 0 , 1 } \left\{ 0,1\right\} { 0,1}
有多个标记类别的学习任务为多分类( m u l t i multi multi- c l a s s class class c l a s s i f i c a t i o n classification classification),常令 ∣ γ ∣ > 2 |\gamma|>2 ∣γ∣>2 - 学习任务——回归( r e g r e s s i o n regression regression):预测连续值
对于回归问题,常令 γ = R \gamma=R γ=R, R R R为常数集
学得模型后,使用其进行预测的过程为测试( t e s t i n g testing testing),被预测的样本为测试示例( t e s t i n g testing testing i n s t a n c e instance instance)或测试样本( t e s t i n g testing testing s a m p l e sample sample);即对于测试示例 x ⃗ \vec{x} x,对于预测映射 f f f,可得到其预测标记 y = f ( x ⃗ ) y=f(\vec{x}) y=f(x)
5.无监督学习( u n s u p e r v i s e d unsupervised unsupervised l e a r n i n g learning learning)
无监督学习是处理没有标记信息的训练数据的学习任务。
- 学习任务——聚类( c l u s t e r i n g clustering clustering):
将训练集中的样本分成若干组,每组称为一个簇( c l u s t e r cluster cluster),这些自动形成的簇可能对应一些潜在的概念划分;但这些概念事先是不知道的。 - 学习任务——降维
6.归纳学习( i n d u c t i v e inductive inductive l e a r n i n g learning learning)
学得模型适用于新样本的能力,称为泛化( g e n e r a l i z a t i o n generalization generalization)能力;具有强泛化能力的模型能很好地适用于整个样本空间。
归纳学习就是从样例中学习,是从特殊到一般的泛化过程,涵盖了监督学习,无监督学习等,也是学习算法的主要讨论对象。
“没有免费的午餐”定理(No Free Lunch Theorem,NFL定理)
脱离具体问题,空泛地谈论“什么学习算法更好”毫无意义,因为若考虑所有潜在的问题,则所有学习算法都一样好,期望性能相同。要谈论算法的相对优劣,必须要针对具体的学习问题;在某些问题上表现好的学习算法,在另些问题上却可能不尽如人意,学习算法自身的归纳偏好与问题是否相配,往往会起到决定性的作用
二,模型评估和选择
(一)概念
- 误差( e r r o r error error)(误差期望):学习器的实际预测输出与样本的真实输出之间的差异
- 训练误差( t r a i n i n g training training e r r o r error error)或经验误差( e m p i r i c a l empirical empirical e r r o r error error):学习器在训练集上的误差
- 泛化误差( g e n e r a l i z a t i o n generalization generalization e r r o r error error):学习器在新样本上的误差
- 欠拟合( u n d e r f i t t i n g underfitting underfitting):模型过于简单,未能很好地捕捉数据的复杂性,导致在训练数据和新数据上表现都不佳
- 过拟合( o v e r f i t t i n g overfitting overfitting):模型过于复杂,过度拟合了训练数据,导致在新数据上表现不佳
- 模型选择( m o d e l model model s e l e c t i o n selection selection):从多个可用的模型中选择最合适的模型,以获得最佳的性能和泛化能力
(二)评估方法
- 测试集( t e s t i n g testing testing s e t set set):用于最终评估模型性能的数据集,测试学习器对新样本的判别能力
- 测试误差( t e s t i n g testing testing e r r o r error error):测试集评估模型预测性能时所得到的模型预测与真实标签之间的差异或错误程度,期望作为泛化误差的近似
1.留出法( h o l d hold hold- o u t out out)
数据集 D D D划分为两个互斥的集合,即训练集 S S S和测试集 T T T, D = S ∪ T D=S \cup T D=S∪T, S ∩ T = ∅ S\cap T=\varnothing S∩T=∅;在S上训练模型,用T评估其测试误差,作为对泛化误差的估计;在使用留出法时,一般要采用若干次随机划分,重复进行实验评估后取平均值作为留出法的评估结果。
训练集 S S S和测试集 T T T的占比都不易过大或过小,否则会降低评估结果的保真性( f i d e l i t y fidelity fidelity);常见做法是将大约 2 3 ∼ 4 5 \frac{2}{3}\sim\frac{4}{5} 32∼54的样本用于训练,剩余样本用于测试。
- 采样( s a m p l i n g sampling sampling):从一个总体或总体中的子集中选择出一部分观察样本
- 分层采样( s t r a t i f i e d stratified stratified s a m p l e sample sample):将总体划分为若干层,并从每一层中独立地进行采样,以保证样本更好地代表总体的不同层次特征
- 保真性(fidelity):提供准确、可靠、真实反映原始数据或系统性能的能力
2.交叉验证法(cross validation)( k k k折交叉验证法, k k k- f o l d fold fold c r o s s cross cross v a l i d a t i o n validation validation)
数据集 D D D划分为 k k k个大小相似的互斥子集,即
D = D 1 ∪ D 2 ∪ … ∪ D k D=D_1\cup D_2\cup…\cup D_k D=D1∪D2∪…∪Dk D i ∩ D j = ∅ ( i ≠ j ) D_i\cap D_j=\varnothing(i\neq j) Di∩Dj=∅(i=j)
每个子集 D i D_i Di都尽可能保持数据分布的一致性,即从 D D D中通过分层采样得到。然后每次用 k − 1 k-1 k−1个子集的并集作为训练集,另一个子集作为测试集;这样就可获得 k k k组训练/测试集,从而可进行 k k k次训练和测试,最终返回的是这 k k k个测试结果的均值
将数据集 D D D划分为 k k k个子集同样存在多种划分方式,为减少因样本划分不同而引入的差别, k k k折交叉验证通常要随机使用不同的划分重复 p p p次,最终的评估结果是这 p p p次 k k k折交叉验证结果的均值
k k k最常用的取值是10,其他常用值有5,20