点学习:通过接收到的数据,归纳提取相同与不同
机器学习: 让计算机以数据为基础,进行归纳与总结
模型:数据解释现象的系统
机器学习:
1.监督学习(机器学习的过程有标注:相当于告诉模型,在什么样的数据特征下应该输出什么样的结果,机器学习的任务就是提炼出输入与标注间的关系,并进行预测)
根据标注是离散值还是连续值,监督学习可分为分类问题和回归问题
1)分类(标注是离散值)
2)回归(标注是连续值)
2.非监督学习(机器学习的过程无标注,完全让数据自己说话,将数据自身的特征在不同的模型中进行不同的表现)
1)聚类
2)关联
3.半监督学习(部分有标注,部分没有标注,有标注的数据可以作用于没有标注的数据,规范与引导聚类或者关联的方向,同时没有标注的数据也可作用于有标注的数据,时刻获得模型对于数据整体情况的影响和反馈)
数据集:训练集、测试集、验证集(6:2:2)
![](https://img-blog.csdnimg.cn/img_convert/58f03134bf2588e0e95a02df19a3b0f1.png)
测试集:通过训练集和测试集的出最优模型后,使用测试集进行模型的预测,用来衡量这个模型的性能和分类能力,即可以把测试集当做从来不存在的数据集,当已经确定模型的参数后,使用测试集进行模型的泛化能力的评价
泛化:对未知数据的预测能力
模型面对训练集和测试集以外的未知数据或者实际场景的数据时预测能力的大小,如果一个模型在训练集和验证集表现良好,而测试集表现不好,那么该模型的泛化能力就比较差,这种现象也叫做过拟合现象,一份数据集切分成训练集,测试集,验证集的方法也叫作交叉验证。有的时候我们会忽略验证集,而通过不断地重复的尝试,来达到验证的目的,这样一个数据集就会只分为训练集,测试集,比例通常取4:1(80%:20%)这些切分一般是随机的,为了全面衡量模型的质量,有时候也会采取K折叠交叉验证
![](https://img-blog.csdnimg.cn/img_convert/ee31c0ec0f4dd4cc45c16ad65b4e129e.png)
监督学习中的分类问题:
![](https://img-blog.csdnimg.cn/img_convert/a1ad06e81a05c9f843e3b4e2d0c99950.png)
注:逻辑斯特映射和人工神经网络大多数既可以做分类也可以做回归问题,主要以回归为主
![](https://img-blog.csdnimg.cn/img_convert/e42826b851febcb392eed09ee924c756.png)
![](https://img-blog.csdnimg.cn/img_convert/1c82bcda1a988f7507f7f7a2e220a41c.png)
KD_Tree:如果一个空间中有很多的点,那么怎么去找我们随机指定的一个点附近的最近的K个点呢?
当然有一种方法就是遍历每一个点,然后进行从小到大的排序。不过效率过低,所以就有了KD-Tree,通过树形结构,可以达到快速寻找最近点的目的。
![](https://img-blog.csdnimg.cn/img_convert/892f5f5c3ae39a5617e5d62f893785f3.png)
这样的话在空间里就会分成很多大小不一的格子,每个格子都通过这里的线建立成一个树形的索引,如果把这些线当成中间节点,而把这些点当做是叶子节点,
![](https://img-blog.csdnimg.cn/img_convert/57aeeb281aea734dceb435c8293e68fd.png)
![](https://img-blog.csdnimg.cn/img_convert/06b282db500f3455145a48c7fb94b72a.png)
![](https://img-blog.csdnimg.cn/img_convert/9f990c2b3161112ea6aeed2aed1a232e.png)
![](https://img-blog.csdnimg.cn/img_convert/dae3c69ed04cf8e6457c7b00d286d70f.png)
![](https://img-blog.csdnimg.cn/img_convert/f9af0984015306c1f3818e02bba9280e.png)
![](https://img-blog.csdnimg.cn/img_convert/872d1cd24805c216e44595ad12283ddf.png)
![](https://img-blog.csdnimg.cn/img_convert/1eb675d5b37976823302171e7d402c89.png)
![](https://img-blog.csdnimg.cn/img_convert/ab4c622d19205e2343ef89cc1e1dfad3.png)
![](https://img-blog.csdnimg.cn/img_convert/138ae938599a9a3422fdeb9f4df6198f.png)
![](https://img-blog.csdnimg.cn/img_convert/6543d927e147f92cbc8dbc267bdcbcdc.png)
![](https://img-blog.csdnimg.cn/img_convert/c8ad49c6c35e0e5b7758e952b9561d13.png)
![](https://img-blog.csdnimg.cn/img_convert/5017e54b476bb5efe3d1636e60a3ef43.png)
![](https://img-blog.csdnimg.cn/img_convert/2d7b3b2002bdf85c9c9806c3022f4996.png)
![](https://img-blog.csdnimg.cn/img_convert/0946db489db93ecab2a7b6be3c3d86c0.png)
生成模型:一般情况下对数据的要求更高一些,比如朴素贝叶斯中要求数据是离散的,速度相对快一些
判别模型:速度相对慢些,但是对数据容忍程度的更大一些,使用的范围也更广一些
![](https://img-blog.csdnimg.cn/img_convert/081d31a9d6d40e11332a5efe8d743d58.png)
在构造决策树的时候,有个问题需要考虑,就是说这些特征的顺序如何摆放?
![](https://img-blog.csdnimg.cn/img_convert/2ac0bb24ddfadb2a7da0be06a98d5a49.png)
决定特征顺序的方法:
熵:代表随机变量或者整个系统的不确定性,熵越大,随机变量或者整个系统的不确定性就越大。
![](https://img-blog.csdnimg.cn/img_convert/618d85645737b06bf382df12ecd2585c.png)
![](https://img-blog.csdnimg.cn/img_convert/161d15de5421668e362fbb8692db2be0.png)
![](https://img-blog.csdnimg.cn/img_convert/734103cf0db87dc703e29b5cdda15257.png)
![](https://img-blog.csdnimg.cn/img_convert/4c497f0638b3ece31ed3ad17fcacc586.png)
![](https://img-blog.csdnimg.cn/img_convert/24be5d17864f97c36d844ec7a9212cd5.png)
![](https://img-blog.csdnimg.cn/img_convert/741d259db093da7a1c8d9f22f0a712b6.png)
![](https://img-blog.csdnimg.cn/img_convert/d48b6d8b978ea7c1f66df0b7f79c2074.png)
![](https://img-blog.csdnimg.cn/img_convert/f2035a0c6b43c293439f0bd0831deae1.png)
![](https://img-blog.csdnimg.cn/img_convert/ca715fc2cea48826a603bd10d7c62dad.png)
![](https://img-blog.csdnimg.cn/img_convert/f4e096bde00f07d3e1c06ede158e4cea.png)
![](https://img-blog.csdnimg.cn/img_convert/a89cbbde8bf55003a702c650b3f3951f.png)
问题:
![](https://img-blog.csdnimg.cn/img_convert/b546dbdf10a609137591ebe67581f308.png)
![](https://img-blog.csdnimg.cn/img_convert/3f365b54a149ce34265d6f762111c2b4.png)
![](https://img-blog.csdnimg.cn/img_convert/2fb5578be7fe76dd1c70600d7b1df8be.png)
![](https://img-blog.csdnimg.cn/img_convert/5db766fb3798a0465c5e7ff86889b387.png)
![](https://img-blog.csdnimg.cn/img_convert/5d50a83e0b9a124c4daea2d261f2a4de.png)
![](https://img-blog.csdnimg.cn/img_convert/7913477ef55ca44bc9d9fab422ebca79.png)
![](https://img-blog.csdnimg.cn/img_convert/fb0496af3cb11a27694d3d05c33a545b.png)
![](https://img-blog.csdnimg.cn/img_convert/3a1c7eeff02151e7470055ea8bf3437c.png)
![](https://img-blog.csdnimg.cn/img_convert/48f3cb904943b51503391ebf157636d2.png)
![](https://img-blog.csdnimg.cn/img_convert/7a85391736ca114bcc6286a2c32526a6.png)
集成方法:组合多个模型,以获得更好的效果
n:数据规模,p,m为常数
![](https://img-blog.csdnimg.cn/img_convert/3f24adc65a40132a1f8e81864fb01e67.png)
![](https://img-blog.csdnimg.cn/img_convert/cf2e2ecb71728c733db35b1ae4c03b42.png)
袋装法应用:随机森立算法
袋装法:把几个不同的分类模型进行独立袋装,然后投票表决,几个子模型间是互相独立的,互不影响的。
![](https://img-blog.csdnimg.cn/img_convert/3e78e077cbd742c3dec7c3c4af5aad43.png)
提升法:boost,如果我们这些子模型串联起来,一个模型以另一个模型的结果为基础,进行训练和预测,然后多个模型级联,最终将每个训练模型的结果进行加权求和,得到判决结果。
注:最后的结果是各个模型的加权叠加,并不是最后一个模型的输出,子模型对样本的差别的影响更大程度上取决于最终的权值,而不是它的顺序
![](https://img-blog.csdnimg.cn/img_convert/9733aa041bae4681376060243340d0cb.png)
![](https://img-blog.csdnimg.cn/img_convert/19b6444241a9e57ea850bf835087d849.png)
![](https://img-blog.csdnimg.cn/img_convert/7377dff00c7530306bb07113168b0554.png)
![](https://img-blog.csdnimg.cn/img_convert/ae7c6cc9bd378b12adf83ad00be649a6.png)