摘要: #KNN(K-Nearest-Neighbor) ###模型介绍 KNN,K近邻算法,对于输入实例,从训练集中找到与其最邻近的K个实例,K实例的均值作为预测(回归模型),为监督模型。 ###KNN三要素 K值 K值过小,可能导致过拟合;K值过大,可能导致欠拟合 距离计算方式 通常使用欧氏距离 决策函 阅读全文
posted @ 2022-08-29 15:59 小艾衰 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 求长度为n数组最大子数组乘积,数组元素只包括[0,1,2,4,8,…1024] 输入: 5 [2,1,4,0,16,1] 输出16 依赖判断,不依赖输出1,依赖输出0(判断是否有环) 给定数据为1 2 3 表示 1 依赖于 2, 3 输入第一行为待判断的点,第二行开始是依赖关系 输入: 1 3 1 阅读全文
posted @ 2022-08-28 12:17 小艾衰 阅读(39) 评论(0) 推荐(0) 编辑
摘要: ##KL散度(相对熵) $KL(P||Q)=\sum{p(x)}log\frac{p(x)}{q(x)}$ $KL(Q||P)=\sum{q(x)}log\frac{q(x)}{p(x)}$ 用来衡量两个分布之间的差异,交叉熵$-p(x)log(q(x))$减去信息熵$-p(x)log(p(x))$ 阅读全文
posted @ 2022-08-15 16:49 小艾衰 阅读(137) 评论(0) 推荐(0) 编辑
摘要: ##混淆矩阵(Confusion Matrix) 混淆矩阵 预测 类1 类2 类3 实际 类1 类2 类3 每一行之和为该类别真实样本数量,每一列之和为预测为该类的样本数量,对角线上为预测正确。 ##TP TN FP FN TP(True Positive): 结果为正例,预测为正例 TN(True 阅读全文
posted @ 2022-08-14 21:53 小艾衰 阅读(103) 评论(0) 推荐(0) 编辑
摘要: | command | short for | description | | | | | | cat | concatenate | 从第一行开始显示文件内容 | | tac | inverse of cat | 从最后一行开始显示文件内容 | | nl | number of lines | 输 阅读全文
posted @ 2022-08-09 16:41 小艾衰 阅读(71) 评论(0) 推荐(0) 编辑
摘要: | command | short for | description | | | | | |ls| list files|列出文件名和目录 |cd| change directory| 切换目录 |pwd| print work directory|当前工作目录 |mkdir|make direc 阅读全文
posted @ 2022-08-09 16:31 小艾衰 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 马尔可夫过程(Markov process)是一类随机过程。它的原始模型马尔可夫链,由俄国数学家A.A.马尔可夫于1907年提出。该过程具有如下特性:在已知目前状态(现在)的条件下,它未来的演变(将来)不依赖于它以往的演变 (过去 )。例如森林中动物头数的变化构成——马尔可夫过程。在现实世界中,有很 阅读全文
posted @ 2022-07-14 15:46 小艾衰 阅读(866) 评论(0) 推荐(1) 编辑
摘要: 使用ImageSequence, 把gif中图片帧序列化成为可迭代对象。 from PIL import ImageSequence image_name = 'gif' for i, frame in enumerate(ImageSequence.Iterator(img)): frame.sa 阅读全文
posted @ 2022-04-14 14:31 小艾衰 阅读(47) 评论(0) 推荐(0) 编辑
摘要: ###plt.tight_layout() ####注意:位置要在plt.show()之前,所有画图函数之后 (有时间再补代码效果图) 这里放图片↓ 阅读全文
posted @ 2022-03-31 10:48 小艾衰 阅读(731) 评论(0) 推荐(0) 编辑
摘要: ###绘制单行或者单列的图表时,不支持索引 ####例: fig, ax = plt.subplots(3, 1) ax[0][0].plot(list,) ax[1][0].plot(list,) ... TypeError: 'AxesSubplot' object does not suppo 阅读全文
posted @ 2022-03-31 10:35 小艾衰 阅读(377) 评论(0) 推荐(0) 编辑