上一页 1 2 3 4 5 6 ··· 19 下一页
摘要: 用google-research官方的bert源码(tensorflow版本)对新的法律语料进行微调,迭代次数为100000次,每隔1000次保存一下模型,得到的结果如下: 将最后三个文件取出,改名为bert_model.ckpt.data-00000-of-00001、bert_model.ckp 阅读全文
posted @ 2021-01-18 14:11 最咸的鱼 阅读(4808) 评论(0) 推荐(0) 编辑
摘要: 1.中文语料常常遇到编码问题,将任意字符集文件转为utf-8编码 1 import chardet 2 import codecs 3 from django.utils.encoding import smart_text 4 5 def check_file_charset(file): #查看 阅读全文
posted @ 2020-12-07 15:41 最咸的鱼 阅读(369) 评论(0) 推荐(0) 编辑
摘要: 数据集的格式如下: datasets train文件夹(WA和WKY文件夹,里面分别存放了200张图片) test文件夹(WA和WKY文件夹,里面分别存放了100张图片) 每一张图片都有自己的文件名,train中WA的图片标签为0,WKY的图片标签为1。 1.构建Dataset 1 import o 阅读全文
posted @ 2020-11-09 20:20 最咸的鱼 阅读(2049) 评论(0) 推荐(2) 编辑
摘要: 94.二叉树的中序遍历 给定一个二叉树,返回它的中序遍历。 实例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,3,2] 递归版: 1 # Definition for a binary tree node. 2 # class TreeNode: 3 # def __ini 阅读全文
posted @ 2020-11-07 12:19 最咸的鱼 阅读(115) 评论(0) 推荐(0) 编辑
摘要: 1.confusion_matrix 理论部分见https://www.cnblogs.com/cxq1126/p/12990784.html#_label2 1 from sklearn.metrics import confusion_matrix 2 3 #if y_true.shape=y_ 阅读全文
posted @ 2020-11-05 21:52 最咸的鱼 阅读(2401) 评论(0) 推荐(0) 编辑
摘要: 我自己改进的模型为model(model = ResNet(Bottleneck, [3, 4, 6, 3], **kwargs)),原模型为resnet50。 1.查看模型参数 现模型: 1 model_dict = model.state_dict() 2 for k,v in model_di 阅读全文
posted @ 2020-10-28 19:56 最咸的鱼 阅读(2404) 评论(0) 推荐(1) 编辑
摘要: 详细理论部分可参考https://www.cnblogs.com/wanghui-garcia/p/10862733.html BCELoss()和BCEWithLogitsLoss()的输出logits和目标labels(必须是one_hot形式)的形状相同。 CrossEntropyLoss() 阅读全文
posted @ 2020-10-17 15:37 最咸的鱼 阅读(5831) 评论(0) 推荐(2) 编辑
摘要: CRF:条件随机场,一种机器学习技术。给定一组输入随机变量条件下,另一组输出随机变量的条件概率分布模型。 以一组词性标注为例,给定输入X={我,喜欢,学习},那么输出为Y={名词,动词,名词}的概率应该为最大。输入序列X又称为观测序列,输出序列Y又称为状态序列。这个状态序列构成马尔可夫随机场,所以根 阅读全文
posted @ 2020-09-25 14:55 最咸的鱼 阅读(6067) 评论(10) 推荐(0) 编辑
摘要: 导包: 1 import re 2 import math 3 import torch 4 import numpy as np 5 from random import * 6 import torch.nn as nn 7 import torch.optim as optim 8 impor 阅读全文
posted @ 2020-09-24 15:08 最咸的鱼 阅读(1135) 评论(0) 推荐(1) 编辑
摘要: 导包: 1 import torch 2 import torch.nn as nn 3 import torch.nn.functional as F 4 import torch.optim as optim 5 from torchvision import datasets, transfo 阅读全文
posted @ 2020-09-20 14:47 最咸的鱼 阅读(2161) 评论(0) 推荐(2) 编辑
上一页 1 2 3 4 5 6 ··· 19 下一页