自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(50)
  • 资源 (5)
  • 收藏
  • 关注

原创 task5

两个连续的3×3卷积核的感受野与一个5×5卷积核的感受野相同。原因:我们假设图片是5*5的我们使用5*5的卷积核对其卷积,步长为1,得到的结果是:(5-5)/1+1=1然后我们使用2个卷积核为3*3的,这里的两个是指2层:第一层3*3:得到的结果是(5-3)/1+1=3第二层3*3:得到的结果是(3-3)/1+1=11×1卷积可以看作是通道维上的全连接。...

2020-02-19 21:24:11 430

原创 task4

关于集束搜索(Beam Search):集束搜索结合了greedy search和维特比算法。集束搜索使用beam size参数来限制在每一步保留下来的可能性词的数量。集束搜索是一种贪心算法,得到局部最优解。...

2020-02-19 21:23:36 151

原创 task3

验证数据集可以用来调整模型参数在数据不够多的时候,k折交叉验证是一种常用的验证方法k折交叉验证将数据分为k份,每次选择一份用于验证模型,其余的用于训练模型过拟合是指训练误差很低,泛化误差相对于训练误差要高很多欠拟合是指训练误差和泛化误差都无法到达一个较低的水平过拟合和欠拟合都是在训练中容易遇到的经典问题模型复杂度低容易导致欠拟合训练数据集小容易导致过拟合...

2020-02-19 21:22:57 161

原创 task2

文本预处理通常包括四个步骤:读入文本 分词 建立字典,将每个词映射到一个唯一的索引(index) 将文本从词的序列转换为索引的序列,方便输入模型随机采样中前后批量中的数据是不连续的。随机采样中每个样本只包含局部的时间序列信息,因为样本不完整所以每个批量需要重新初始化隐藏状态。采用相邻采样仅在每个训练周期开始的时候初始化隐藏状态是因为相邻的两个批量在原始数据上是...

2020-02-14 21:15:15 136

原创 task1

以下代码可直接运行,注意注释从零实现线性回归import torch as tfrom matplotlib import pyplot as pltimport numpy as npimport randomnum_input = 2num_example = 1000true_w = [2,-3.4]true_b = 4.2features = t.randn(nu...

2020-02-14 21:14:01 177

原创 tensorflow2.0初体验(手写数字识别)

import tensorflow as tftry: import tensorflow.python.keras as kerasexcept: import tensorflow.keras as kerasfrom tensorflow.python.keras import layersmnist = keras.datasets.mnist(x_train,...

2019-06-04 01:55:45 5665 9

原创 python异常处理try...except

异常类型的网址:https://docs.python.org/3/library/exceptions.html#bltin-exceptions与Python异常相关的关键字:与Python异常相关的关键字:关键字 关键字说明raise 抛出/引发异常try/except 捕获异常并处理pass 忽略异常as ...

2019-05-28 03:34:03 253

原创 分词器keras.preprocessing.text.Tokenizer的使用

下面例子的文本输入texts可以是一个list类型,也可以是一个series类型(所以可以也可以用dataframe的某一列),import tensorflow as tftexts = ["你好 我好 你好 你好 你好 我们 大家 都 好 吗 吗 吗 吗 吗", "分词器 训练 文档 训练 文档 文档 你好 我好"]tokenizer = tf.contrib.keras.prepro...

2019-04-29 22:00:17 5087

原创 用gensim做word2vec词向量

如果词的文件太大,考虑用迭代器来进行一部分一部分地输入。如果词的文件存在数据库中,可以用迭代器来一行一行地进行输入。如果词存在一个dataframe中,可以用迭代器来把dataframe每一行输入。例子如下,只是为了示范使用方法,语料随便挑的,太少了,一般不会这样:import gensimimport pandas as pdtext = [["双方", "要", "持续", "深...

2019-04-29 21:57:44 583

原创 模型融合stacking实战

模型融合stacking的原理具体不再解释,有的博客已经解释很清楚了,还是附一张经典图吧,直接上完整程序(根据后面的数据集下载地址可以下载数据集,然后直接运行程序):# Load in our librariesimport pandas as pdimport numpy as npimport reimport xgboost as xgbimport warningswa...

2019-03-16 15:25:52 1428

原创 跳跃游戏Jump Game

Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Determine if you ...

2019-03-03 18:07:53 190

原创 买股票的最佳时间之二Best Time to Buy and Sell Stock II

Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complete as many transactions as you like (i.e., buy one...

2019-03-03 14:55:47 101

原创 买卖股票的最佳时间Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), ...

2019-03-03 14:18:37 113

原创 电话号码的字母组合Letter Combinations of a Phone Number

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is give...

2019-03-02 12:40:50 161

原创 分类问题评估函数

sklearn的metrics包中有写好的函数可以直接调用混淆函数参考网址:https://www.cnblogs.com/klchang/p/9608412.htmlTensorflow tf.confusion_matrix 中的 num_classes 参数的含义, 与 scikit-learn sklearn.metrics.confusion_matrix 中的 labels 参数...

2019-02-27 01:47:46 577

转载 一些数据集下载地址

以下内容转自https://baijiahao.baidu.com/s?id=1615853849218131902&wfr=spider&for=pc图像分类领域1)MNIST经典的小型(28x28 像素)灰度手写数字数据集,开发于 20 世纪 90 年代,主要用于测试当时最复杂的模型;到了今日,MNIST 数据集更多被视作深度学习的基础教材。fast.ai 版本的数据集舍...

2019-02-20 23:13:46 2252 1

原创 git命令使用之二

新建github远程仓库和本地仓库,并把本地仓库内容上传到github上的远程仓库。我的github上新建了一个仓库叫test_git,这个test_git仓库中没有任何文件(连readme文件都没有),然后我先在本地新建一个名叫zgj的文件夹(注意,这个名字要和后面本地仓库联系远程仓库时的名字相同),然后进入这个zgj文件,打开git bash,进行以下命令操作:1、git init2、g...

2019-02-18 00:48:47 267

原创 git命令使用之一

现在我要在本地电脑上修改github上一个仓库的内容并重新上传到github进行更新新建一个本地文件夹test20190217two,并且此时github上有一个仓库叫Commen_Code。(不要在意取名,随手取的)在test20190217two文件夹下打开git bash,进行以下命令操作:1、git init此时本地文件夹test20190217two下会有一个.git文件夹2、...

2019-02-17 23:31:55 152

原创 搜索插入位置Search Insert Position

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array.Ex...

2019-02-17 20:05:48 98

原创 python中的mongdb操作

。。mongdb数据库,最基本的操作当然还是增删改查,详见例子。插入数据,可以用insert(),insert_one(),insert_many(),详见例子。插入之后,每一条数据会有一个id,我们也可以在插入前自己指定id,然后再插入。如下:mylist = [ { "_id": 1, "name": "RUNOOB", "cn_name": &

2019-02-17 15:46:09 148

原创 关于None,NaN , 空字符的比较与处理

参考博客:https://blog.csdn.net/August1226/article/details/80652048当进行count操作时,NaN和None都不计算在内,""则被计算在内;当进行sum等计算时,会对除NaN和None以外的值进行计算。无法把NaN转化为int型,否则会报错。(转换函数用astype)。我们可以先将NaN用fillna赋值为0,再进行转换为int型。Va...

2019-02-17 13:18:35 385

原创 最长共同前缀Longest Common Prefix

Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string “”.Example 1:Input: [“flower”,“flow”,“flight”]Output: “fl...

2019-02-12 10:17:21 282

原创 正则表达式匹配Regular Expression Matching

Given an input string (s) and a pattern §, implement regular expression matching with support for ‘.’ and ‘*’.‘.’ Matches any single character.‘*’ Matches zero or more of the preceding element.The ...

2019-02-11 18:17:54 144

原创 装最多水的容器Container With Most Water

Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two l...

2019-02-11 18:16:07 196

原创 回文数字判断Palindrome Number

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplanation...

2019-02-09 21:16:26 292

原创 字符串转数字String to Integer (atoi)

Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this...

2019-02-09 14:57:25 207

原创 反转数字Reverse Integer

Given a 32-bit signed integer, reverse digits of an integer.Example 1:Input: 123Output: 321Example 2:Input: -123Output: -321Example 3:Input: 120Output: 21Note:Assume we are dealing with an ...

2019-02-09 00:50:53 81

原创 找最长无重复子字符串的长度Longest Substring Without Repeating Characters.

Given a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example 2:Input: ...

2019-02-07 23:13:47 153

原创 寻找最长回文子字符串Longest Palindromic Substring

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: “babad”Output: “bab”Note: “aba” is also a valid answer.Example ...

2019-02-07 23:11:32 157

原创 数组中两数相加Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same e...

2019-02-05 16:09:40 169

原创 python中的类

类在__init__() 方法的定义中,形参self必不可少,还必须位于其他形参的前面。为何必须在方法定义中包含形参self呢?因为python调用这个__init__()方法来创建实例时,将自动传入实参self。每个与类相关联的方法调用都自动传递实参self,它是一个指向实例本身的引用,让实例能访问类中的属性和方法。以self为前缀的变量都可供类中的所有方法使用。class Car(): ...

2019-01-23 18:43:12 147

原创 python中的函数

函数def describe_pet(pet_name,animal_type ='dog'): # 形参可以指定默认值 print("I have a "+ animal_type +".") print("My " + animal_type + "'s name is " + pet_name.title()+".")# 有如下几种方式调用上面的函数describ...

2019-01-23 18:40:58 124

原创 python的输入和while循环

用户输入通过input函数输入数字的时候,input函数得到的是字符串类型的数值,要使用int型的数字,应该先进行类型转换。age = input('how old are you?')print("age:",age)print("type(age):",type(age))age = int(age)print("age:",age)print("type(age):",type...

2019-01-23 18:22:44 133

原创 python中的字典

字典基本操作,增删改查alien_0 ={}alien_0['color'] = 'green' # 增加键值对alien_0['point'] = 5print("alien_0:",alien_0)alien_0['color'] = 'yellow' # 修改字典中的值print("alien_0:",alien_0)del alien_0['point'] # 删除字...

2019-01-23 18:19:26 90

原创 python中的列表使用

列表记住四个基本操作:增删改查1、访问列表,索引为-1表示列表的最后一个元素,索引为-2表示列表的倒数第二个元素2、修改表中的元素3、在列表末尾添加表元素(append()),在列表中间插入元素(insert()), 用append()动态创建列表很容易4、删除元素(del,pop,remove)。pop源自这样的类比:列表就像一个栈,而删除列表末尾的元素相当于弹出栈顶元素。 pop和...

2019-01-23 01:18:04 139

原创 python中字符串与数字的使用

字符串大小写title()函数,使得只有单词的首字母大写(名字的形式就是这样)name1 = 'ada love'name2 = 'ADa LOVE'name3 = 'ada LOve'print(name1.title())print(name2.title())print(name3.title())Ada LoveAda LoveAda Loveupper()函数...

2019-01-23 01:10:18 750

原创 单词和字符的onehot编码

直接看代码即可,代码注释还是比较详细的。1、单词级的 one-hot 编码import numpy as npsamples = ['the cat sat on the mat.','the dog ate my homework','the chicken is delicious']token_index = {} # 单词和索引组成的字典for sample in sample...

2019-01-21 17:55:10 2167

原创 二叉树最大深度Maximum Depth of BinaryTree

Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Note: A leaf is a node with no children....

2019-01-21 01:45:43 149

原创 用MLP做电影评论二分类

本文程序原理等说明(也可以去程序中查看注释,注释比较多)本节使用 IMDB 数据集,它包含来自互联网电影数据库(IMDB)的 50 000 条严重两极分化的评论。数据集被分为用于训练的 25 000 条评论与用于测试的 25 000 条评论,训练集和测试集都包含 50% 的正面评论和 50% 的负面评论。与 MNIST 数据集一样,IMDB 数据集也内置于 Keras 库。它已经过预处理:...

2019-01-20 19:43:22 2039

原创 用RNN加attention做手写数字识别

关于RNN部分的介绍可以看这里:https://blog.csdn.net/zgj_gutou/article/details/86501084关于attention,其实网上的介绍原理和相关论文有很多很多,比我讲的应该会好一些。我这里再用自己的话简单通俗地解释一下,RNN+attention中,首先RNN的每个单元都会有一个输出,假设RNN的时间长度为10,也就是会有10个输出,我们利用att...

2019-01-20 02:40:24 909

中文文本分类语料(由复旦大学李荣陆提供)(附停用词).rar

1、资源中有语料,本语料库由复旦大学李荣陆提供。test_corpus为测试语料,共9833篇文档;train_corpus为训练语料,共9804篇文档,两个预料各分为20个相同类别。训练语料和测试语料基本按照1:1的比例来划分。使用时尽量注明来源(复旦大学计算机信息与技术系国际数据库中心自然语言处理小组)。 2、资源中还附有一份停用词。

2019-12-01

textCNN文本分类相关论文Convolutional Neural Networks for Sentence Classification

textCNN文本分类相关论文Convolutional Neural Networks for Sentence Classification

2019-03-16

jdk-8u11-linux-x64.tar.gz

本资源为jdk-8u11-linux-x64.tar.gz,64位,欢迎大家下载!

2018-01-24

统计学习方法_李航

本资源为李航的《统计学习方法》,是经典书籍,也是学习机器学习,数据挖掘等算法的经典书籍。欢迎下载!

2018-01-15

jdk-7u60-windows-x64下载地址

该资源为jdk-7u60-windows-x64.exe jdk1.7 64位 欢迎大家下载!

2018-01-03

空空如也

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

TA关注的人

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