自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 MAP 与 MRR

看论文时,发现对于wikiqa的评价指标常设为MAP、MRR这些Rank排序的指标,不是很理解,看了下面这篇博客有些理解了http://blog.csdn.net/lightty/article/details/47079017 在MAP中,四个文档和query要么相关,要么不相关,也就是相关度非0即1。MAP(Mean Average Precision):单个主题的平均准确率是每篇相关文档检索...

2018-03-20 22:23:24 14090

原创 leetcode 329. Longest Increasing Path in a Matrix

leetcode 329. Longest Increasing Path in a Matrix下面这个解法的错误之处在于,最长路径不会遵循左上 或 右上 这样的法则,可以同时包含两种模式。class Solution { public int longestIncreasingPath(int[][] matrix) { int m = matrix

2017-11-19 18:12:19 395

原创 leetcode 333. Largest BST Subtree

leetcode 333. Largest BST Subtree/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val =

2017-10-07 13:26:12 710

原创 leetcode 265. Paint House II

leetcode 265. Paint House IIclass Solution { public int minCostII(int[][] costs) { int N = costs.length; if(N==0) return 0; int k = costs[0].length; if(k=

2017-10-07 12:26:29 648

原创 【dp】leetcode 276. Paint Fence

【dp】leetcode 276. Paint Fenceclass Solution { public int numWays(int n, int k) { if(n==0||k==0) return 0; int[][][] dp = new int[n+1][k][2]; for(int j=0;j<k;j++){

2017-10-06 23:59:31 446

原创 leetcode 542. 01 Matrix

bfs:  先0后1 再1后1dp: 从左上到右下,从右下到左上https://leetcode.com/problems/01-matrix/solution/#approach-2-using-bfs-accepted

2017-08-15 00:37:28 542

原创 RNN Summarization

quora 数据集:https://www.quora.com/Has-Deep-Learning-been-applied-to-automatic-text-summarization-successfully

2017-08-12 23:55:25 491

原创 leetcode Add to List 425. Word Squares

leetcode   Add to List 425. Word Squareszip(*)  当前列就是下一行的前缀,用这个来遍历, square 为4时输出方阵。class Solution(object): def wordSquares(self, words): """ :type words: List[str] :rty

2017-08-12 21:41:09 497

原创 【二叉搜索树:删除指定结点】leetcode 450. Delete Node in a BST

leetcode 450. Delete Node in a BST/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x

2017-08-12 16:22:38 353

原创 【tree 反转二叉树 inverse binary tree】

/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution {

2017-08-12 15:52:59 372

原创 【平衡二叉树】leetcode 110. Balanced Binary Tree

leetcode 110. Balanced Binary Tree/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x;

2017-08-12 14:54:39 330

原创 【tree】【 由中根序遍历与后根序遍历生成树】【由先根序与中根序遍历生成树】

递归思想,找到根节点,问题便分解为左子树与右子树leetcode 106. Construct Binary Tree from Inorder and Postorder Traversal/** * Definition for a binary tree node. * public class TreeNode { * int val; * Tr

2017-08-12 12:43:44 629

原创 leetcode 289. Game of Life

leetcode 289. Game of Life谷歌的面试题果然很开眼界,比如这题,用两bit来表示前后两次的状态,很巧妙。public class Solution { public void gameOfLife(int[][] board) { if(board==null||board.length==0) return; int m

2017-08-09 23:02:14 316

原创 【矩阵子阵求和问题】 leetcode 308. Range Sum Query 2D - Mutable

// package my;public class NumMatrix { public static void main(String[] args){ int[][] examp = new int[2][2]; NumMatrix obj = new NumMatrix(examp); obj.update(0,0,1);// System.out.println

2017-08-06 16:23:58 868

原创 leetcode 146. LRU Cache 链表操作与缓存处理

public class LRUCache { class DlinkedNote{ int key; int value; DlinkedNote pre; DlinkedNote post; DlinkedNote(){} DlinkedNote(int key, int value){ this.key = ke

2017-08-06 12:11:26 763

原创 leetcode 484. Find Permutation

leetcode 484. Find Permutation 贪心算法全靠细心,思路简单:初始: S[0] = 'I', 设为1。cur 变量用来记录前面最大的值(因为所求的为置换关系),后续有多少个D,则当前写入最大的值,后续依次减小就可以。class Solution(object): def findPermutation(self, s): """

2017-08-06 10:34:22 942

原创 leetcode 545. Boundary of Binary Tree

leetcode 545. Boundary of Binary Tree这一题考察的是树型的先序遍历,三角形正好是先序遍历的访问点,需要做的工作就是识别出是否为边界,在下面的代码中全靠flag变量来处理参考solution : https://leetcode.com/problems/boundary-of-binary-tree/discuss/public clas

2017-08-05 21:58:39 620

原创 leetcode 625. Minimum Factorization

leetcode 625. Minimum Factorization题目中给的是最小的,所以思考时从2开始想起,陷入怎样将多个2组合,比较混乱。从9开始,把大的因子取出来,很多问题都可以用贪心的办法来解决,关键是要找到贪心的策略public class Solution { public int smallestFactorization(int a) {

2017-08-05 16:35:59 882

原创 卡方检验

总算是把卡方检验的思想看懂了用来判断概率分布X与Y是否有关。所以在文本特征选择中,有如下的计算公式:

2017-08-05 11:38:25 955

原创 leetcode 340. Longest Substring with At Most K Distinct Characters

leetcode 340. Longest Substring with At Most K Distinct Characters下面的实现是很直观的,记下当前所包含的字符数,采用双指针进行移动public class Solution { public static void main(String[] args){ Solution s = new Solution();

2017-08-01 23:32:37 480

原创 149. Max Points on a Line

149. Max Points on a Line我已经尽力了:package my;import java.util.HashMap;import java.util.HashSet;import java.util.Map;// [[0,0],[1,1],[1,-1]]public class Solution { public static void mai

2017-07-31 22:58:52 248

原创 leetcode 126. Word Ladder II

leetcode 126. Word Ladder II   写这一题 真的非常适合复习bfs与dfs啊import java.util.ArrayList;import java.util.HashMap;import java.util.HashSet;import java.util.LinkedList;import java.util.List;import java.ut

2017-07-30 19:43:37 359

原创 leetcode 466. Count The Repetitions

leetcode 466. Count The Repetitions这一题主要考察复杂问题的简化求解思路,从简单的例子着手。public class Solution { public int getMaxRepetitions(String s1, int n1, String s2, int n2) { if (!ableToObtain(s1, s2)) r

2017-07-27 23:35:50 1065

原创 java 单例设计模式

java设计模式--单例模式

2017-07-25 22:26:05 181

原创 leetcode 51. N-Queens

leetcode 51. N-QueensN-queen N 皇后问题: python解法:dfs, 建立树,然后根据建立的树获取答案class Solution(object): def solveNQueens(self, n): """ :type n: int :rtype: List[List[str]]

2017-07-24 23:43:22 269

原创 leetcode 126. Word Ladder II

今天这篇笔记讲讲一直都弄得不是很清楚的回溯算法。回溯写法用于dfs比较常见,由于深度优先,如果搜完之后还需要继续搜索,那么就只好往前回溯了。深度优先之所以需要这样遍历,是为了不重复搜索,特别是这种树形结构的。在形式上比较像bfs,但实质上是dfs,因为一定是在一个搜索路径下走完,才来寻找其他的路径。这一题下面这种解法确实有一些难度,先是用bfs来建立树,并且利用层次进行标明,然后再利用dfs反

2017-07-24 23:06:56 334

原创 fasttext 相关笔记

两篇不错的论文解读博客http://www.algorithmdog.com/fast-fasttexthttps://heleifz.github.io/14732610572844.htmlgithub 传送门:https://github.com/facebookresearch/fastText

2017-07-19 21:52:32 307

原创 Leetcode 126. Word Ladder II

.

2017-07-18 23:22:59 304

原创 Leetcode 188. Best Time to Buy and Sell Stock IV

Leetcode 188. Best Time to Buy and Sell Stock IV 很久很久没有刷到这么好的题目了,很经典的DP题目,动态规划简而言之,就是要学会分情况讨论。public class Solution { public static void main(String[] args){ Solution s = new Solution(); in

2017-07-18 21:51:38 280

原创 java并发编程:volatile 关键字解析

这篇文章将并发编程的概念讲得很清楚: 点击打开链接Java并发编程:volatile关键字解析从并发编程的三个概念讲起:原子性、可见性、有序性。原子性(整体,要么执行、要么不执行)可见性(当前的修改使后续得缓存失效)有序性(顺序执行)voliatile  可以保证可见性、有序性,但原子性不一定能够保证。public class Test { pu

2017-07-16 10:22:37 425

原创 Best Time to Buy and Sell Stock

leetcode  123. Best Time to Buy and Sell Stock III下面这种方法构思巧 难想到public class Solution { public int maxProfit(int[] prices) { // these four variables represent your profit after ex

2017-07-11 22:41:31 352

原创 leetcode 381. Insert Delete GetRandom O(1) - Duplicates allowed

leetcode 381. Insert Delete GetRandom O(1) - Duplicates allowed熟悉数据结构:Set  Iterator  next() 这些函数的用法public class RandomizedCollection { ArrayList nums; HashMap> locs; java.util.Random ran

2017-07-11 21:30:22 242

原创 leetcode 381. Insert Delete GetRandom O(1) - Duplicates allowed

待继续了解....public class RandomizedCollection { ArrayList nums; HashMap> locs; java.util.Random rand = new java.util.Random(); /** Initialize your data structure here. */ public Rando

2017-07-10 23:04:53 293

原创 leetcode 233. Number of Digit One

leetcode 233. Number of Digit One问题分解: 分治进行计算的思想public class Solution { public int countDigitOne(int n) { if(n<=0) return 0; int r = 0; for(long m=1;m<=n;m=m*10){

2017-07-10 22:51:12 287

原创 leetcode 552. Student Attendance Record II

leetcode  552. Student Attendance Record II又一题动态规划public class Solution { public int checkRecord(int n) { final int MOD = 1000000007; int[][][] f = new int[n+1][2][3]

2017-07-09 22:33:32 355

原创 leetcode 99. Recover Binary Search Tree

复习数据结构:二叉查找树/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public cl

2017-07-09 22:32:15 246

原创 leetcode 72. Edit Distance

leetcode 72. Edit Distance编辑距离,动态规划public class Solution { public int minDistance(String word1, String word2) { int l_1 = word1.length(); int l_2 = word2.length();

2017-07-09 21:04:32 282

原创 【论文阅读】Sequential Matching Network: A New Architecture for Multi-turn Response Selection in Retrieval

2017ACL 论文 作者有来自MSRA的 chatbot 中利用到多轮对话中上下文信息,答案是检索得到的,文章重点在讲如何对多轮对话上下文信息进行建模,答案候选抽取不是重点。一个示例,比如在下图中两个候选中选哪个?显然应该是候选1,有上下文信息。 模型架构 实现结果 语料: 1. Ubuntu Corpus[1] 2. Douban Conversation Corpus文章的语料与

2017-07-09 11:48:07 3361

原创 【论文阅读】A Neural Conversational Model

这是google放在arvix上的一篇论文,写得是非常轻松随意,模型也很简洁,结果自称Modest。对话只做到了一问一答,没有做到多轮,采用了两层LSTM进行建模,4096 cells大小,100K words, 到输出层的时候将4096 cells投影到2048 units。(OpenSubtitles dataset 上的配置,在另外一个小数据集上,cell的大小会变得小一点)模型: 在推理时

2017-07-09 10:21:43 1919

原创 【论文阅读】Generating Natural Answers by Incorporating Copying and Retrieving Mechanisms in Sequence-to-S

采用拷贝与检索机制在序列预测的模型中生成自然语言的问题答案为了生成自然语言答案,现有的方法通常利用一些了的NLP tools与归纳模板,这种方式覆盖度低,难以应对丰富的语言现象,文章将问答看做端到端的学习问题,在应对问答时,通过分析问题、在知识库中检索来生成连贯的正确地答案。在解码阶段,不同于机器翻译,预测词并非都来自设定好的词表,而是分别来自词表、问题本身以及知识库,通过在网络中结合问句与知识库的

2017-07-08 21:33:50 2099

空空如也

空空如也

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

TA关注的人

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