随笔分类 -  机器学习

摘要:参考:ROC与AUC 1. 总结:绘制ROC曲线时,横坐标是FPR(False Positive Rate),纵坐标是TPR(True Positive Rate),ROC曲线上的每一个点由一个分类器(例如逻辑回归分类器)取某一个概率阈值(例如取0.8作为阈值,则预测的概率大于0.8视为正样本,否则 阅读全文
posted @ 2021-12-07 11:56 morein2008
摘要:Say you have one feature and a target with 3 possible values X = np.array([3.4, 3.4, 3. , 2.8, 2.7, 2.9, 3.3, 3. , 3.8, 2.5]) y = np.array([0, 0, 0, 1 阅读全文
posted @ 2021-12-06 21:10 morein2008
摘要:参考:什么是卡方检验 连续投掷硬币50次,其中22次为正面,28次为方面,问这枚硬币是否是正常硬币? 这是个假设检验的问题。 若用卡方检验来做,需要先用上面的公式计算卡方值X2,然后查表看卡方值有没有落入指定区间,即可判定是否应该接受假设。 类似的抛骰子的例子:抛36次,已知各个点数朝上的次数,问是 阅读全文
posted @ 2021-11-19 16:00 morein2008
摘要:用LDA模型抽取文本特征,再用线性SVM分类,发现效果很差,F1=0.654。 Precision:0.680,Recall:0.649,F1:0.654 RandomForestClassifier的表现也比较差: Precision:0.680,Recall:0.668,F1:0.670 而随便 阅读全文
posted @ 2020-12-04 20:20 morein2008
摘要:1、accuracy即我们通常理解的准确率,计算的时候是指在预测值pred与目标值target之间重叠的部分的大小除以pred的大小(或target的大小,因为sklearn要求pred与target大小必须一致)。 比如 target=[2,2,2,3,2] pred=[2,2,1,3,4] 此时 阅读全文
posted @ 2020-10-23 17:36 morein2008
摘要:numpy、tensorflow手写SkipGram(没有negative sampling)和cbow: http://www.claudiobellei.com/2018/01/07/backprop-word2vec-python/ 这两种实现都需要动手算梯度,手动实现梯度下降,且不没有使用n 阅读全文
posted @ 2020-07-10 18:01 morein2008
摘要:https://blog.floydhub.com/the-transformer-in-pytorch/ 哈佛版本:http://nlp.seas.harvard.edu/2018/04/03/attention.html https://pytorch.org/docs/1.3.0/_modul 阅读全文
posted @ 2020-07-10 17:08 morein2008
摘要:word2vec.py import torch import torch.nn.functional as F import numpy as np import time import jieba class SkipGram(torch.nn.Module): def __init__(sel 阅读全文
posted @ 2020-06-29 00:57 morein2008
摘要:word2vec.py import torch import torch.nn.functional as F import numpy as np class SkipGram(torch.nn.Module): def __init__(self,vocab_size,embedding_si 阅读全文
posted @ 2020-06-28 19:37 morein2008
摘要:卷积层Conv的输入:高为h、宽为w,卷积核的长宽均为kernel,填充为pad,步长为Stride(长宽可不同,分别计算即可),则卷积层的输出维度为: 其中上开下闭开中括号表示向下取整。 MaxPooling层的过滤器长宽设为kernel*kernel,则池化层的输出维度也适用于上述公司计算。 具 阅读全文
posted @ 2020-03-11 19:50 morein2008
摘要:《动手学深度学习》在线文档,numpy版本:https://zh.d2l.ai/chapter_preface/preface.html 阅读全文
posted @ 2020-01-08 10:30 morein2008
摘要:用Pytorch写了两个CNN网络,数据集用的是FashionMNIST。其中CNN_1只有一个卷积层、一个全连接层,CNN_2有两个卷积层、一个全连接层,但训练完之后的准确率两者差不多,且CNN_1训练时间短得多,且跟两层的全连接的准确性也差不多,看来深度学习水很深,还需要进一步调参和调整网络结构 阅读全文
posted @ 2019-10-25 19:11 morein2008
摘要:尝试用Pytorch实现第一个用于图片分类的最简单的全连接神经网络,包括了神经网络的定义、使用DataLoader批训练、效果的准确性评估,模型使用方法、输出转换为label型等内容。 阅读全文
posted @ 2019-10-23 20:51 morein2008
摘要:最近我在用Macbook Pro练习PyTorch的时候,发现明明在终端已经用pip安装了PyTorch,但在pycharm运行时总是报错:No module named torch. 但是我把同样的代码用Spyder跑就没有问题,感动很费解,找了很多资料,终于弄明白了。原来Pycharm、Spyd 阅读全文
posted @ 2019-10-12 16:27 morein2008
摘要:1 import numpy as np 2 import matplotlib.pyplot as plt 3 from .plot_helpers import cm2, cm3, discrete_scatter 4 5 def _call_classifier_chunked(classifier_pred_or_decide, X): 6 # The chun... 阅读全文
posted @ 2018-12-19 23:18 morein2008
摘要:1. 连续型特征的常用的归一化方法、离散型特征one-hot编码的意义 2. 度量特征之间的相关性 :余弦相似度和皮尔逊相关系数 阅读全文
posted @ 2018-11-19 20:23 morein2008
摘要:对SVM的个人理解 浅显易懂 阅读全文
posted @ 2018-11-06 10:19 morein2008
摘要:读懂stacking:模型融合Stacking详解/Stacking与Blending的区别 https://blog.csdn.net/u014114990/article/details/50819948 https://mlwave.com/kaggle-ensembling-guide/ T 阅读全文
posted @ 2018-10-30 18:38 morein2008
摘要:上手机器学习,从搞懂这十大经典算法开始 集成学习方法 图解十大经典机器学习算法入门 机器学习之Validation(验证,模型选择) PLA算法总结——Percetron Learning Algorithm(机器学习基石2) 阅读全文
posted @ 2018-10-22 11:57 morein2008
摘要:https://www.cnblogs.com/gatherstars/p/6084696.html ROC的全名叫做Receiver Operating Characteristic,其主要分析工具是一个画在二维平面上的曲线——ROC curve。平面的横坐标是false positive rat 阅读全文
posted @ 2018-09-13 13:24 morein2008 阅读(353) 评论(0) 推荐(0)