自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(46)
  • 收藏
  • 关注

原创 MYSQL表操作

一、学习内容1.MySQL表数据类型参考教材:http://www.runoob.com/mysql/mysql-data-types.htmlMySQL支持多种类型,大致可以分为三类:数值、日期/时间和字符串(字符)类型。1.1 数值类型MySQL支持所有标准SQL数值数据类型。这些类型包括严格数值数据类型(INTEGER、SMALLINT、DECIMAL和NUMERIC),以及近似...

2019-04-04 20:51:52 153 1

原创 MYSQL基本语句

导入示例数据库教程 SQL是什么?MySQL是什么?2.1 SQLSQL(/ˈsiːkwəl/,Structured Query Language,结构化查询语言),用于管理关系数据库管理系统(RDBMS),或在关系流数据管理系统(RDSMS)中进行流处理。SQL的范围包括数据插入、查询、更新和删除,数据库模式创建和修改,以及数据访问控制。SQL在1986年成为美国国家标准学会...

2019-04-02 21:14:35 170

原创 MySQL基础知识与数据库管理系统

数据库定义数据库(Database)是按照数据结构来组织、存储和管理数据的仓库。每个数据库都有一个或多个不同的 API 用于创建,访问,管理,搜索和复制所保存的数据。关系型数据库我们也可以将数据存储在文件中,但是在文件中读写数据速度相对较慢。所以,现在我们使用关系型数据库管理系统(RDBMS)来存储和管理的大数据量。所谓的关系型数据库,是建立在关系模型基础上的数据库,借助于集合代...

2019-03-31 22:04:09 376

原创 特征选择

特征选择是特征工程里的一个重要问题,其目标是寻找最优特征子集。特征选择能剔除不相关(irrelevant)或冗余(redundant )的特征,从而达到减少特征个数,提高模型精确度,减少运行时间的目的。另一方面,选取出真正相关的特征简化模型,协助理解数据产生的过程。一、特征选择的一般流程特征选择的过程主要分为产生过程,评估过程,停止条件和验证过程。*二、 具体特征选择方法根据特征选择...

2019-03-23 11:01:09 394

原创 TextRNN和TextRCNN实现文本分类

TextRNNTextRNN原理这里的文本可以一个句子,文档(短文本,若干句子)或篇章(长文本),因此每段文本的长度都不尽相同。在对文本进行分类时,我们一般会指定一个固定的输入序列/文本长度:该长度可以是最长文本/序列的长度,此时其他所有文本/序列都要进行填充以达到该长度;该长度也可以是训练集中所有文本/序列长度的均值,此时对于过长的文本/序列需要进行截断,过短的文本则进行填充。总之,要使...

2019-03-18 00:17:57 3180 1

原创 机器学习面试题目

1、逻辑斯特回归为什么要对特征进行离散化?解析:在工业界,很少直接将连续值作为逻辑回归模型的特征输入,而是将连续特征离散化为一系列0、1特征交给逻辑回归模型,这样做的优势有以下几点:a. 离散特征的增加和减少都很容易,易于模型的快速迭代;b. 稀疏向量内积乘法运算速度快,计算结果方便存储,容易扩展;c. 离散化后的特征对异常数据有很强的鲁棒性:比如一个特征是年龄>30是1,否则...

2019-03-18 00:09:19 2257

原创 递归+回溯+分治+动态规划

1.递归思考以下几个问题:边界条件递归前进段 (子问题的递推公式)递归返回段 (最小子问题,即在程序的边界)爬楼梯假设你正在爬楼梯。需要 n 阶你才能到达楼顶。每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢?·from functools import lru_cacheclass Solution: @lru_cache(10**8) ...

2019-03-16 22:53:59 565

原创 Text-CNN的原理与应用

目前对NLP的研究分析应用最多的就是RNN系列的框架,比如RNN,GRU,LSTM等等,再加上Attention,基本可以认为是NLP的标配套餐了。但是在文本分类问题上,相比于RNN,CNN的构建和训练更为简单和快速,并且效果也不差,所以仍然会有一些研究。那么,CNN到底是怎么应用到NLP上的呢?不同于CV输入的图像像素,NLP的输入是一个个句子或者文档。句子或文档在输入时经过embeddin...

2019-03-15 22:04:49 1547 1

原创 NLP词向量

离散表示One-hot独热表示法NLP 中最常用、最传统的词特征表示方式是采用One-Hot 编码,即每一个词特征都被表示成一个很长的向量,其长度等于词表大小,当前词对应位置为1,其他位置为0。但是这种表示方式存在显而易见的问题:* 不同词之间总是正交的,无法衡量不同词之间的相似关系。* 只能反映每个词是否出现,但无法突出词之间重要性的区别。BOW词袋表示法在One-Hot ...

2019-03-13 21:24:46 247

原创 图的深度优先搜索和广度优先搜索

1、深度优先搜索介绍图的深度优先搜索(Depth First Search),和树的先序遍历比较类似。它的思想:假设初始状态是图中所有顶点均未被访问,则从某个顶点v出发,首先访问该顶点,然后依次从它的各个未被访问的邻接点出发深度优先搜索遍历图,直至图中所有和v有路径相通的顶点都被访问到。 若此时尚有其他顶点未被访问到,则另选一个未被访问的顶点作起始点,重复上述过程,直至图中所有顶点都被访问到为...

2019-03-13 20:11:55 111

原创 正则化与优化技术

1、深度学习中的正则化正则化技术是保证算法泛化能力的有效工具,因此算法正则化的研究成为机器学习中主要的研究主题。此外,正则化还是训练参数数量大于训练数据集的深度学习模型的关键步骤。正则化可以避免算法过拟合,过拟合通常发生在算法学习的输入数据无法反应真实的分布且存在一些噪声的情况。过去数年,研究者提出和开发了多种适合机器学习算法的正则化方法,如数据增强、L2 正则化(权重衰减)、L1 正则化、Dr...

2019-03-11 23:25:32 869

原创 二叉树

实现一个二叉查找树,并且支持插入、删除、查找操作实现查找二叉查找树中某个节点的后继、前驱节点实现二叉树前、中、后序以及按层遍历完成leetcode上的验证二叉搜索树(98)及二叉树 层次遍历(102,107)...

2019-03-11 21:55:23 98

原创 朴素贝叶斯

朴素贝叶斯的原理:基于朴素贝叶斯公式,比较出后验概率的最大值来进行分类,后验概率的计算是由先验概率与类条件概率的乘积得出,先验概率和类条件概率要通过训练数据集得出,即为朴素贝叶斯分类模型,将其保存为中间结果,测试文档进行分类时调用这个中间结果得出后验概率。1.1 基本定义分类是把一个事物分到某个类别中。一个事物具有很多属性,把它的众多属性看作一个向量,即x=(x1,x2,x3,…,x...

2019-03-10 17:12:42 174

原创 LeetCode 202. Happy Number

题目描述Write an algorithm to determine if a number is “happy”.A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squ...

2019-03-10 16:11:48 66

原创 NLP实践-特征选择

TF-IDF原理1.1 文本向量化特征的不足  在将文本分词并向量化后,我们可以得到词汇表中每个词在各个文本中形成的词向量,比如在文本挖掘预处理之向量化与Hash Trick这篇文章中,我们将下面4个短文本做了词频统计:corpus=["I come to China to travel", "This is a car polupar in China", ...

2019-03-08 23:00:54 198

原创 LeetCode 390. Elimination Game

题目描述There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.Repeat the previous st...

2019-03-08 22:58:45 472

原创 散列表

实现一个基于链表法解决冲突问题的散列表public class ChainingHashSet { public static class HashSet<K,V>{ private int num; private int capacity; private SearchNode<K,V>[] st; public H...

2019-03-07 23:56:18 142

原创 字符串

实现一个字符集,只包含 a~z 这 26 个英文字母的 Trie 树import java.util.LinkedList;class Node{ char content; boolean isEnd; int count; LinkedList<Node> childList; public Node(char c) { childList=new Linke...

2019-03-07 23:55:18 142

原创 LeetCode 344. Reverse String

题目描述Write a function that reverses a string. The input string is given as an array of characters char[].Do not allocate extra space for another array, you must do this by modifying the input array ...

2019-03-07 23:54:26 78

原创 LeetCode 151. Reverse Words in a String

题目描述:Given an input string, reverse the string word by word.Example 1:Input: "the sky is blue"Output: "blue is sky the"Example 2:Input: " hello world! "Output: "world! hello"Explanation: ...

2019-03-07 23:48:55 82

原创 LeetCode 8. 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 fr...

2019-03-07 23:27:20 67

原创 LeetCode 617.Merge Two Binary Trees

题目描述:Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are not.You need to merge them into a new bina...

2019-03-07 22:40:20 51

原创 二分查找

实现一个有序数组的二分查找算法public class BinarySearch { public static int binarysearch(int[] arr, int key, int low, int high) { if(low <= high) { int mid=low + (high - low)/2; if(key == arr[mid]) {...

2019-03-05 21:19:13 80

原创 LeetCode 69. Sqrt(x)

题目描述Implement int sqrt(int x).Compute and return the square root of x, where x is guaranteed to be a non-negative integer.Since the return type is an integer, the decimal digits are truncated and...

2019-03-05 21:18:25 70

原创 排序

归并排序public class Merge{ private static int[] aux; public static void sort(int[] a){ aux = new int[a.length]; sort(a, 0, a.lemgth-1); } private static void sort(int[] a, int lo, int hi){ i...

2019-03-05 20:53:43 64

原创 机器学习常用评价指标

1.准确率、召回率、精确率准确率是指分类正确的样本个数占总样本个数的比例。准确率是分类问题中最简单也是最直观的评价指标,但存在明显的缺陷。比如,但负样本占99%时,分类器把所有样本预测为负样本也可以获得99%的准确率。所以,当不同类别的样本比例非常不平衡时,占比大的类别往往称为影响准确率的最主要因素。精确率(Precision)是指分类正确的正样本个数占分类器判定为正样本的样本个数的比例。...

2019-03-03 21:04:55 272

原创 NLP实践-数据集探索

1、THUCNews1.1 数据集介绍本数据集是清华NLP组提供的THUCNews新闻文本分类数据集的一个子集(原始的数据集大约74万篇文档,训练起来需要花较长的时间)。本次训练使用了其中的10个分类(体育, 财经, 房产, 家居, 教育, 科技, 时尚, 时政, 游戏, 娱乐),每个分类6500条,总共65000条新闻数据。数据集划分如下:cnews.train.txt: 训练集(...

2019-03-03 20:44:57 570

原创 递归

编程实现斐波那契数列求值 f(n)=f(n-1)+f(n-2)编程实现求阶乘 n!编程实现一组数据集合的全排列Climbing Stairs(爬楼梯)英文版:文版:https://leetcode.com/problems/clim...

2019-03-02 18:26:47 76

原创 队列

队列用数组实现一个顺序队列用链表实现一个链式队列public class Queue<Item>{ private Node first; private Node last; private int N; private class Node{ Item item; Node next; } public boolean isEmpty(){ retur...

2019-03-02 18:11:11 76

原创 LeetCode 239. Sliding Window Maximum

题目描述Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the sliding wi...

2019-03-02 18:10:04 97

原创 LeetCode 641. Design Circular Deque

题目描述Design your implementation of the circular double-ended queue (deque).Your implementation should support following operations:MyCircularDeque(k): Constructor, set the size of the deque to be ...

2019-03-02 18:02:03 102

原创

栈用数组实现一个顺序栈用链表实现一个链式栈编程模拟实现一个浏览器的前进、后退功能Valid Parentheses(有效的括号)英文版:文版:https://leetcode.com/problems/valid-parentheses/中文版中文版:文版:https://leetcode-cn.com/problems/valid-parentheses/LonLongest ...

2019-03-02 17:02:24 63

原创 LeetCode 150. Evaluate Reverse Polish Notation

题目描述Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Note:Division between two integ...

2019-03-02 16:38:55 83

原创 LeetCode 414. Third Maximum Number

题目描述Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n).Example 1:Input: [3, 2...

2019-03-02 15:25:09 69

原创 LeetCode 20. Valid Parentheses

题目描述Given a string containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type...

2019-03-02 14:15:36 63

原创 链表

1.实现单链表、循环链表、双向链表,支持增删操作2.实现单链表反转public class reverseList{ public class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } public ListNode reverse(ListNode node) { List...

2019-02-28 21:48:03 85

原创 LeetCode 23. Merge k Sorted Lists

题目描述:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[1->4->5,1->3->4,2->6]Output: 1-&g

2019-02-28 21:44:44 61

原创 LeetCode 141. Linked List Cycle

题目描述:Given a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where ...

2019-02-28 21:38:18 75

原创 数组

1.实现一个支持动态扩容的数组基本思路:当元素数量等于数组大小时,如果继续添加元素,则将数组容量扩大为原来的两倍;如果元素个数达到数组容量的1/4时,将数组容量收缩为原来的1/2。public class ResizingArray<Integer>{ private int[] a = new int[]; private N = 0; private void res...

2019-02-28 20:59:45 90

原创 LeetCode 169. Majority Element

题目描述:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority eleme...

2019-02-28 20:58:41 77

空空如也

空空如也

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

TA关注的人

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