自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 资源 (1)
  • 收藏
  • 关注

原创 crf

import reimport sklearn_crfsuitefrom sklearn_crfsuite import metricsfrom sklearn.externals import joblibdir = "//15基于CRF的中文命名实体识别模型实现//"class CorpusProcess(object): def __init__(self): """初始化""" self.train_corpus_path = dir+ "1980

2020-07-10 08:18:37 124

原创 bilstmcrf

import torchimport torch.nn as nnimport torch.optim as optimtorch.manual_seed(1)# some helper functionsdef argmax(vec): # return the argmax as a python int # 第1维度上最大值的下标 # input: tensor([[2,3,4]]) # output: 2 _, idx = torch.max(v

2020-07-10 08:10:55 185

原创 hmmpostagging

# 初始化词典tag2id, id2tag = {},{}word2id, id2word = {},{}#建立词典for line in open("traindata.txt"): items = line.split("/") word, tag = items[0],items[1].rstrip() if word not in word2id: word2id[word]=len(word2id) id2word[len(id2

2020-07-08 07:53:12 153

原创 hmmtrain

#!/usr/bin/env python3# coding: utf-8# open: hmm_train.py# Author: lhy<lhy_in_blcu@126.com,https://huangyong.github.io># Date: 18-3-26class HmmTrain: def __init__(self): self.line_index = -1 self.char_set = set() def in

2020-07-07 23:36:20 241

原创 hmmcut

#!/usr/bin/env python3# coding: utf-8# File: hmm_cut.py# Author: lhy<lhy_in_blcu@126.com,https://huangyong.github.io># Date: 18-3-26class HmmCut: def __init__(self): trans_path = './model/prob_trans.model' emit_path = './mod

2020-07-07 23:35:20 161

原创 attention6

# -- encoding:utf-8 --"""原始数据:[百, 柳, 报, 春, 兆] ----> [千,花,传,欢,乐]模型训练的时候,将原始数据进行转换:编码器输入: [百, 柳, 报, 春, 兆]解码器输入: [GO, 千,花,传,欢]解码器输出(实际值): [千,花,传,欢,乐]"""import tensorflow as tfdef build_interface(encoder_inputs, encoder_vocab_size,

2020-06-22 00:09:28 96

原创 seq2seq2

# -- encoding:utf-8 --"""原始数据:[小明, 吃, 苹果] ----> [xiao, ming, eats, apples]模型训练的时候,将原始数据进行转换:编码器输入: [小明, 吃, 苹果]解码器输入: 无解码器输出(实际值): [xiao, ming, eats, apples, EOS]"""import tensorflow as tfdef build_interface(encoder_inputs, enco

2020-06-19 08:10:29 91

原创 seq2seq1

# -- encoding:utf-8 --"""原始数据:[小明, 吃, 苹果] ----> [xiao, ming, eats, apples]模型训练的时候,将原始数据进行转换:编码器输入: [小明, 吃, 苹果]解码器输入: [GO, xiao, ming, eats, apples]解码器输出(实际值): [xiao, ming, eats, apples, EOS]"""import tensorflow as tfdef build_i

2020-06-19 08:09:47 181

原创 attention

# -- encoding:utf-8 --"""原始数据:[百, 柳, 报, 春, 兆] ----> [千,花,传,欢,乐]模型训练的时候,将原始数据进行转换:编码器输入: [百, 柳, 报, 春, 兆]解码器输入: [GO, 千,花,传,欢]解码器输出(实际值): [千,花,传,欢,乐]"""import tensorflow as tfdef build_interface(encoder_inputs, encoder_vocab_size,

2020-06-19 08:08:22 118 1

原创 w2v

# -- encoding:utf-8 --import osimport tensorflow as tfclass CBOWNetwork(object): def __init__(self, name="W2V", num_sampled=100, window=4, vocab_size=3365, embedding_size=128, is_mean=True, regularization=0.001, optimizer_name='

2020-06-18 07:38:30 290

原创 data_util

# -- encoding:utf-8 --import reimport osimport jiebaimport jsonimport numpy as npfrom collections import defaultdictre_han = re.compile(r"([\u4E00-\u9FD5]+)", re.U)PAD = "<PAD>" # 用于数据填充的UNKNOWN = "<UNKNOWN>" # 用于训练数据中不存在的数据def

2020-06-18 07:37:24 262

原创 train

# -- encoding:utf-8 --import osimport tensorflow as tffrom nets.w2vnet import CBOWNetwork, SkipGramNetworkfrom utils.data_utils import DataManager# parameters# =====================================# 模型训练数据参数tf.flags.DEFINE_string("data_path", ".

2020-06-18 07:34:24 323

原创 convert_data

# -- encoding:utf-8 --import osimport tensorflow as tffrom utils.data_utils import convert_sentence_to_wordsfrom utils.data_utils import build_dictionaryfrom utils.data_utils import convert_words_to_recordtf.app.flags.DEFINE_string("opt", "split",

2020-06-18 07:33:34 669

原创 剧本gen

"""项目:电视剧本生成。数据集:https://www.kaggle.com/wcukierski/the-simpsons-by-the-data提交时间:12月29日之前。 提交邮箱:yingjun@ibefeing.com"""from utils import helperimport numpy as npimport warningsfrom tensorflow.contrib import seq2seqimport tensorflow as tf# 数据读取...

2020-06-10 07:59:59 113

原创 英文情感

import numpy as npimport tensorflow as tffrom string import punctuationfrom collections import Counter# 介绍预览该项目,并介绍该项目网络结构!with open('../datas/sentiment/reviews.txt', 'r') as f: reviews = f.read()with open('../datas/sentiment/labels.txt', 'r'..

2020-06-10 07:58:48 206

原创 中文情感

import numpy as npimport matplotlib.pyplot as pltimport reimport jiebaimport osfrom sklearn.model_selection import train_test_splitfrom gensim.models import KeyedVectorsfrom keras.models import Sequentialfrom keras.layers import Dense, GRU, Embed..

2020-06-10 07:58:07 90

原创 Word2vec

# Embedding Skip-gramimport timeimport numpy as npimport tensorflow as tffrom utils import utilsfrom urllib.request import urlretrievefrom os.path import isfile, isdirfrom tqdm import tqdmimport zipfilefrom collections import Counterimport ran..

2020-06-10 07:57:08 74

原创 双向rnn英小短文

import osimport numpy as npimport tensorflow as tfdef load_data(file_path): """ 加载原始数据 :param file_path: :return: """ with open(file_path, 'r') as reader: data = reader.readlines() return datadef create_lookup_ta..

2020-06-09 00:40:14 94

原创 rnnapi

import tensorflow as tf"""tf.nn.rnn_cell # 定义rnn 细胞核相关的信息的tf.nn.rnn_cell_impl # 定义rnn细胞核具体是如何实现的tf.nn.dynamic_rnn() # 单向动态rnn。tf.nn.bidirectional_dynamic_rnn() # 双向动态rnntf.nn.static_rnn() # 单向静态rnntf.nn.static_bidirectional_rnn()..

2020-06-09 00:39:37 94

原创 charrnn

"""单词字符级别预测RNN"""import timefrom collections import namedtupleimport numpy as npimport tensorflow as tfimport oswith open('../datas/anna.txt', 'r') as f: text = f.read()vocab = sorted(set(text)) # 取文本中唯一的字符,共83个。vocab_to_int = {c: i f.

2020-06-09 00:38:38 157

原创 MobileNetOps

MobileNetOps.pyimport tensorflow as tf“”"实现Mobile_Net_V3的各个模块。“”"weight_decay = 1e-3def hswish(x, name=‘hswish’):return tf.multiply(x, tf.nn.relu6(x+3) / 6, name=name)def batch_norm(x, momentum=0.99, epsilon=1e-5, train=True, name=‘bn’):return tf.

2020-06-09 00:31:31 89

build-tools_r23.0.1-windows

Android开发所需的Build-Tools,版本为23.0.1

2016-08-03

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除