自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 JVM Internal

This article explains the internal architecture of the Java Virtual Machine (JVM). The following diagram show the key internal components of a typical JVM that conforms to The Java Virtual Machine

2014-08-14 13:35:23 717

转载 机器学习中的数学(1)-回归(regression)、梯度下降(gradient descent)

版权声明:   本文由LeftNotEasy所有,发布于http://leftnoteasy.cnblogs.com。如果转载,请注明出处,在未经作者同意下将本文用于商业用途,将追究其法律责任。前言:   上次写过一篇关于贝叶斯概率论的数学,最近时间比较紧,coding的任务比较重,不过还是抽空看了一些机器学习的书和视频,其中很推荐两个:一个是stanford的machin

2013-08-26 18:08:51 762

原创 Max Entropy Model study note

随机事件的信息熵:设随机变量ξ,它有A1,A2,A3,A4,……,An共n种可能的结局,每个结局出现的概率分别为p1,p2,p3,p4,……,pn,则其不确定程度,即信息熵为:举例:抛硬币p(head) = 0.5, p(tail) = 0.5信息熵为H(p) = -(0.5 * log(0.5) * 2) = -log0.5 = 1(log以2为底)

2013-08-22 15:47:19 870

转载 字符串匹配的KMP算法

字符串匹配是计算机的基本任务之一。举例来说,有一个字符串"BBC ABCDAB ABCDABCDABDE",我想知道,里面是否包含另一个字符串"ABCDABD"?许多算法可以完成这个任务,Knuth-Morris-Pratt算法(简称KMP)是最常用的之一。它以三个发明者命名,起头的那个K就是著名科学家Donald Knuth。这种算法不太容易理解,网上

2013-05-27 22:04:35 599

转载 中文分词算法介绍

1. 最大匹配法 (正向/逆向)正向/逆向匹配法思想一样,只是一个从左向右切分,另一个从右向左切分,这里拿逆向匹配法举例子:输入例句:S1=”计算语言学课程有意思” ;定义:最大词长MaxLen = 5;S2= ” “;分隔符 = “/”;假设存在词表:…,计算语言学,课程,意思,…;最大逆向匹配分词算法过程如下: (1)S2=”";S1不为空,从S1右边取出候选子串W=”

2013-05-23 21:59:37 3974

原创 中文分词评测方法

实际的分词结果有四种:1. True -> True, TP — true positive (真正, TP)表示被模型预测为正的正样本2. True -> False,FP — false positive (假正, FP)被模型预测为正的负样本3. False -> True,TN — true negative (真负 , TN)被模型预测为负的负样本4. False ->

2013-05-23 21:39:18 1727

原创 线段树入门

引用Wiki对线段树的介绍:线段树(Segment Tree)是一种二叉搜索树,它将一个区间划分成一些单元区间,每个单元区间对应线段树中的一个叶结点。对于线段树中的每一个非叶子节点[a,b],它的左子树表示的区间为[a,(a+b)/2],右子树表示的区间为[(a+b)/2+1,b]。因此线段树是平衡二叉树。叶节点数目为N,即整个线段区间的长度。使用线段树可以快速的查找某

2013-05-15 14:51:11 714

原创 从头开始编写基于隐含马尔可夫模型HMM的中文分词器之二 - 模型训练与使用

我们使用/icwb2-data.rar/training/msr_training.utf8  用以训练模型,这个词库里包含已分词汇约2000000个。使用经典的字符标注模型,首先需要确定标注集,在前面的介绍中,我们使用的是{B,E}的二元集合,研究表明基于四类标签的字符标注模型明显优于两类标签,原因是两类标签过于简单而损失了部分信息。四类标签的集合是 {B,E,M,S},其含义如下:B:

2013-05-14 16:16:55 2981 5

原创 从头开始编写基于隐含马尔可夫模型HMM的中文分词器之一 - 资源篇

首先感谢52nlp的系列博文(http://www.52nlp.cn/),提供了自然语言处理的系列学习文章,让我学习到了如何实现一个基于隐含马尔可夫模型HMM的中文分词器。在编写一个中文分词器前,第一步是需要找到一些基础的词典库等资源,用以训练模型参数,并进行后续的结果评测,这里直接转述52nlp介绍的“中文分词入门之资源”:原文地址:http://www.52nlp.cn/%E4

2013-05-14 15:47:12 4305

转载 几种不同程序语言的HMM版本

“纸上得来终觉浅,绝知此事要躬行”,在继续翻译《HMM学习最佳范例》之前,这里先补充几个不同程序语言实现的HMM版本,主要参考了维基百科。读者有兴趣的话可以研究一下代码,这样对于HMM的学习会深刻很多!C语言版:1、 HTK(Hidden Markov Model Toolkit):  HTK是英国剑桥大学开发的一套基于C语言的隐马尔科夫模型工具箱,主要应用于语音识别、语音合成的研

2013-05-10 22:25:18 828

原创 Leetcode - Subsets

基本功题,用回溯实现代码:public class Solution { public ArrayList> subsets(int[] S) { // Start typing your Java solution below // DO NOT write main() function ArrayList> results = ne

2013-05-03 15:28:38 846

原创 LeetCode - Interleaving String

本打算用类似于最长上升子序列的动态规划记忆化搜索实现,意外的竟然直接用回溯搜索就能pass Judge Large了,测试用例并不大是一个原因,还有就是子状态数可能要比想像中的要少。public class Solution { public boolean isInterleave(String s1, String s2, String s3) { // Start

2013-04-28 14:33:44 1133

原创 Google Code Jam 2013 - Bullseye

题目很简单,需要注意的是在大dataset规模下的怎样让程序运行时间不超时package Round_1_A;import java.io.File;import java.io.FileNotFoundException;import java.io.PrintWriter;import java.util.Scanner;public class Bullseye { /

2013-04-27 22:22:11 799

原创 LeetCode - Flatten Binary Tree to Linked List

树的前序遍历算法:/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution

2013-04-26 18:45:19 593

原创 LeetCode - Distinct Subsequences

回溯实现:public class Solution { public int numDistinct(String S, String T) { // Start typing your Java solution below // DO NOT write main() function return work(S, T, 0,

2013-04-26 17:06:40 655

原创 LeetCode - Populating Next Right Pointers in Each Node

编程题,按层次遍历,利用一个分隔树节点进行层次的分隔/** * Definition for binary tree with next pointer. * public class TreeLinkNode { * int val; * TreeLinkNode left, right, next; * TreeLinkNode(int x) { va

2013-04-25 19:00:50 553

原创 LeetCode - Pascal's Triangle II

简单的编程题,响应题目要求,不用额外的存储空间public class Solution { public ArrayList getRow(int rowIndex) { // Start typing your Java solution below // DO NOT write main() function ArrayLis

2013-04-25 18:17:21 945

原创 LeetCode - Pascal's Triangle

简单的编程题public class Solution { public ArrayList> generate(int numRows) { // Start typing your Java solution below // DO NOT write main() function ArrayList> result = new A

2013-04-25 18:09:17 1127

原创 LeetCode - Triangle

最简单的递归写法,可以pass Judge Small, TLE Judge Largepublic class Solution { public int minimumTotal(ArrayList> triangle) { // Start typing your Java solution below // DO NOT write main

2013-04-25 16:11:29 1163

原创 LeetCode - Best Time to Buy and Sell Stock III

先算出所有的赚钱区间,用一个列表存所有的购入时机,用另一个列表存所有的卖出时机。然后在这两个列表里取出两个买入节点,两个卖出节点,把收益最大化:public class Solution { public int maxProfit(int[] prices) { int in = -1; int index = -1; List buy

2013-04-24 17:01:39 881

原创 LeetCode - Best Time to Buy and Sell Stock II

动态规划记忆化搜索实现,时间复杂度应该小于O(N^3),可以pass Judge Smallpublic class Solution { public int maxProfit(int[] prices) { // Start typing your Java solution below // DO NOT write main() funct

2013-04-24 15:48:04 1222

原创 LeetCode - Best Time to Buy and Sell Stock

public class Solution { public int maxProfit(int[] prices) { // Start typing your Java solution below // DO NOT write main() function if (prices.length < 1) ret

2013-04-24 14:46:10 672

原创 LeetCode - Binary Tree Maximum Path Sum

递归加记忆化搜索,PASS Large Judge/** * Definition for binary tree * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public

2013-04-23 18:10:25 548

原创 LeetCode - Valid Palindrome

通过Large Judge还挺不容易public class Solution { public boolean isPalindrome(String s) { int i=0, j=s.length()-1; while (i < j) { char ci=' ', cj=' '; while (i<j

2013-04-23 17:27:12 691

原创 LeetCode - Word Ladder

public class Solution { public int ladderLength(String start, String end, HashSet dict) { // Start typing your Java solution below // DO NOT write main() function LinkedLis

2013-04-23 16:20:40 1333

原创 LeetCode - Longest Consecutive Sequence

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest consecutive elements sequence is [1,

2013-04-22 19:32:49 802

原创 LeetCode - Surrounded Regions

Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region .For example,X X X XX O

2013-04-22 17:21:46 1524

原创 Leetcode - Palindrome Partitioning

Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab",Return [ ["aa"

2013-04-20 23:09:25 555

原创 leetcode - Palindrome Partitioning II

Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s.For example, given s = "aab",Return

2013-04-19 17:32:58 626

原创 UVA 10051 Tower of Cubes

动态规划实现,用二维数组存储各个面朝上的情况package Ch9;import java.util.ArrayList;import java.util.List;import java.util.Scanner;public class Main { /** * @param args */ public static void main(

2013-03-30 17:57:31 596

原创 Topcoder SRM 573 WolfPackDivTwo

Problem Statement    Wolf Sothe is a member of the wolf pack called Grid Walkers. The N wolves in the pack are numbered 0 through N-1. (Wolf Sothe is the wolf number 0, but this does not matter.)

2013-03-20 00:05:10 765

转载 使用sun.misc.Unsafe获取java对象地址

在传统的Java编程中,你将不再需要从内存中处理Java对象或位置。 当你在论坛上讨论这一点,提出的第一个问题是为什么你需要知道Java对象的地址? 它是一种有效的问题。 但以往,我们保留进行试验的权利。探索未知领域的问题并没有什么错。我想出了一个使用sun公司包的实验。Unsafe是一个属于sun.misc包。对你来说可能这个包有点陌生,看看源代码和方法,你就可以知道我所指的是什么了。J

2013-03-12 11:48:14 1297

原创 Linux下Java 通过JNI native与C进行交互的方法实现示例

第一步:定义Java类文件:public class Sample { public native int intMethod(int n); public native boolean booleanMethod(boolean bool); public native String stringMethod(String text); public nati

2013-03-10 21:15:47 823

原创 UBuntu下载编译安装内核

一、下载内核源码Ubuntu下使用apt-get命令可以下载内核源码:apt-get install linux-source下载完成后源码压缩包将会在/usr/src目录下。二、解压源代码  注意,网上很多教程上说应该解压到 /usr/src,纯属以讹传讹,linux掌门人linus说解压到任何目录上都可以。当然,linus的说法是正确的。先将压缩包复制到usr/sr

2013-03-06 17:09:49 1049

转载 Linus:利用二级指针删除单向链表

原文地址:http://coolshell.cn/articles/8990.htmlLinus大婶在slashdot上回答一些编程爱好者的提问,其中一个人问他什么样的代码是他所喜好的,大婶表述了自己一些观点之后,举了一个指针的例子,解释了什么才是core low-level coding。下面是Linus的教学原文及翻译——“At the opposite end

2013-02-04 12:22:48 545

转载 dlmalloc解析连载(4)

原文地址:http://blog.chinaunix.net/uid-7907749-id-2037210.html上两篇讲解的chunk块是dlmalloc内比较细粒度的管理结构,比它们更大的内存块被称之为段(segment),其结构体以及相关定义如下:struct malloc_segment { char* base; /* ba

2013-02-01 17:22:08 452

转载 dlmalloc解析连载(3)

原文:http://blog.chinaunix.net/uid-7907749-id-2037209.html上一篇讨论了dlmalloc对大小在256字节以下的chunk块进行的组织管理,本篇我们再来看看对于大小在256字节以上的chunk块,dlmalloc是如何管理的。对于大小在256字节以上的chunk块,dlmalloc也采用了所谓的分箱机制,不过由于大于256的数

2013-02-01 17:20:22 562

转载 dlmalloc解析连载(2)

原文地址:http://blog.chinaunix.net/uid-7907749-id-2037208.html前面连载提到过对于大小在256字节以下的chunk块是通过malloc_chunk组织管理的,256字节以下的chunk块一共有256/8=32类,即字节为8字节、16字节、24字节、32字节,……,256字节,因此dlmalloc维护32个双向环形链表(而且具有链表

2013-02-01 17:16:47 403

转载 dlmalloc解析连载 (1)

原文:http://blog.chinaunix.net/uid-7907749-id-2037206.htmldlmalloc是目前一个十分流行的内存分配器,其由Doug Lea(主页为http://gee.cs.oswego.edu/)从1987年开始编写,到目前为止,最新版本为2.8.3(可以从ftp://g.oswego.edu/pub/misc/malloc.c获取),由于其高效率等

2013-02-01 17:13:23 511

转载 巧夺天工的kfifo

原文地址:http://blog.csdn.net/linyt/article/details/5764312Linux kernel里面从来就不缺少简洁,优雅和高效的代码,只是我们缺少发现和品味的眼光。在Linux kernel里面,简洁并不表示代码使用神出鬼没的超然技巧,相反,它使用的不过是大家非常熟悉的基础数据结构,但是kernel开发者能从基础的数据结构中,提炼出优美的

2013-02-01 10:53:36 344

空空如也

空空如也

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

TA关注的人

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