自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 [Leetcode]146. LRU Cache @python

题目Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if the

2016-01-29 13:56:46 1431

原创 [Leetcode]142. Linked List Cycle II @python

题目Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up: Can you solve it without using extra space?题目要求给定一个链表,如果

2016-01-28 12:08:55 999

原创 [Leetcode]126. Word Ladder II python

题目Given two words (beginWord and endWord), and a dictionary’s word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:Only one letter can be changed at a time Each

2016-01-24 23:42:52 2419

原创 [Leetcode]127. Word Ladder@python

题目Given two words (beginWord and endWord), and a dictionary’s word list, find the length of shortest transformation sequence from beginWord to endWord, such that:Only one letter can be changed at a tim

2016-01-24 22:33:15 1556

原创 [Leetcode]105. Construct Binary Tree from Preorder and Inorder Traversal@python

题目Given preorder and inorder traversal of a tree, construct the binary tree.Note: You may assume that duplicates do not exist in the tree.题目要求给定对一个binary-tree的前序遍历和中序遍历。重建二叉树。解题思路前序遍历的第一个值为根节点的值,在中序遍历

2016-01-24 14:17:16 831

原创 [Leetcode] 98. Validate Binary Search Tree @python

题目Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node’s key. The rig

2016-01-24 13:49:55 634

原创 [Leetcode]97. Interleaving String @python

题目Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example, Given: s1 = “aabcc”, s2 = “dbbca”,When s3 = “aadbbcbcac”, return true. When s3 = “aadbbbaccc”, return fal

2016-01-24 12:40:50 469

原创 [Leetcode]91. Decode Ways@python

题目A message containing letters from A-Z is being encoded to numbers using the following mapping:‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Given an encoded message containing digits, determine the total number

2016-01-23 18:38:34 1292

原创 [leetcode]87. Scramble String @python

题目Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = “great”: great / \ gr

2016-01-23 13:48:26 621

原创 [Leetcode]Search in Rotated Sorted Array II

题目Follow up for “Search in Rotated Sorted Array”: What if duplicates are allowed?Would this affect the run-time complexity? How and why?Write a function to determine if a given target is in the array.

2016-01-23 13:19:42 216

原创 [Leetcode]76. Minimum Window Substring @python

题目Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example, S = “ADOBECODEBANC” T = “ABC” Minimum window is “BANC”.Note

2016-01-21 21:52:24 1328

原创 [Leetcode]68. Text Justification @python

题目Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should pack your words in a greedy approach; that is,

2016-01-20 22:14:43 992

转载 修改apache服务器根目录

In my Ubuntu 14.04 LTS, the document root was set to /var/www/html. It was configured in the following file:/etc/apache2/sites-available/000-default.conf So just do asudo nano /etc/apache2/sites-avail

2016-01-20 19:31:00 524

转载 转载:阿里云服务器 ECS Ubuntu系统安装配置

转自阿里云服务器 ECS Ubuntu系统安装配置 要查看图文详细说明,请点击上面的链接看原文。 ssh root@公网IP 阿里云服务器-ECS-Ubuntu系统安装配置-6输入root密码进行登录阿里云服务器-ECS-Ubuntu系统安装配置-7修改root账号密码并新建一个管理账户 为了安全起见,必须改掉初始的root用户密码,另建一个足够复杂强度的新密码。输入命令passwd

2016-01-20 18:50:35 1403

翻译 [Deeplearning]5监测学习过程(from A practical guide to training restricted boltzmann machine)

最简单的监测学习过程的方法,就是计算数据和重建可见层数据的平方和误差。 但是平方和误差并不能很准确的表示学习的效果。 小的平法误差和并不能表示模型开始变得不好,但是大的平方误差和通常意味着模型开始变的不好了。但也有可能是学习速率、冲量、权重cost、稀疏性参数改变导致的平方和误差的大的改变。 对此,Hinton给的建议是,使用平方和误差作为监测学习过程的手段,但是并不完全相信它。 如果你有l

2016-01-20 17:12:29 538

翻译 [Deeplearning]mini-batch大小的选择

内容来在 A Practical Guide to Training Restricted Boltzmann Machines mini-batch 的大小通常选为10-100。 为了避免在改变mini-batch大小时需要改变学习速率,所以需要将在mini-batch上得到的梯度处理mini-batch的大小。 如果选择随机梯度下降的方法进行优化,最好不要将mini-batch的大小设置的

2016-01-20 16:51:42 6481

翻译 [DeepLearning]如何使用对比散度(How to use Contrastive Divergence)

假设可见层和隐藏层单元都是二值的。学习的目的是针对训练数据构建一个好的生成模型。更新隐藏层假设隐藏层单元是二值的,而且使用的是CD1CD_1,隐藏层单元在通过数据向量驱动得到时应该具有随机的二值状态。隐藏层单元置为1的概率为 p(hj=1)=σ(bj+∑iviWij)p(h_j=1)=\sigma (b_j + \sum_i v_iW_{ij}) 随机生成一个均匀分布的0到1之间的值,如果该值大

2016-01-20 14:47:22 2100

翻译 [Deeplearning]对比散度算法(CD算法)

本篇博文是对基于能量的模型和波尔兹曼机关于对比散度算法的总结。对比散度算法(Contrastive Divergence)尽管利用Gibbs采样,我们可以得到对数似然函数关于未知参数梯度的近似,但是通常情况下,需要使用较大的采样步数,这使得RBM的训练效率仍然不高,尤其当观测数据的特征维数较高时。2002年Hinton提出了RBM的一个快速学习算法,对比散度算法(Contrastive Diverg

2016-01-19 15:23:38 23836 1

转载 [DeepLearning] Gibbs采样

本篇博文是对基于能量的模型和波尔兹曼机关于Gibbs采样的总结。 Gibbs采样是一种基于马尔可夫链蒙特卡罗(Markov Chain Monte Carlo,MCMC)策略的采样方法。对于一个K维随机向量X=(X1,X2,...,Xk)X=(X_1,X_2,...,X_k),假设我们无法求得关于X的联合概率分布P(X),但是我们知道在给定X的其它分量时,其第kk个分量XkX_k的条件分布,即P(

2016-01-19 14:59:40 992

转载 [Deeplearning]能量模型(EBM)

本篇博客是对基于能量的模型和波尔兹曼机学习的总结。1. 基于能量的模型(EBM)基于能量的模型主要有两个任务,一个是推断(Inference),在给定观察变量的情况下,找到使能量值最小的那些隐变量的配置。另一个是学习(Learning),寻找一个恰当的能量函数,使得观察变量的能量比隐变量的能量低。 基于能量的概率模型通过一个能量函数来定义概率分布。 p(x)=e−E(x)Z...(1)p(x)=

2016-01-19 14:45:25 8478 1

原创 [Leetcode]61. Rotate List @python

题目Given a list, rotate the list to the right by k places, where k is non-negative.For example: Given 1->2->3->4->5->NULL and k = 2, return 4->5->1->2->3->NULL.题目要求给定链表和非负数k,将链表内的元素向右移动k位。解题思路解题思路参考南郭

2016-01-18 22:44:37 371

原创 [Leetcode]54. Spiral Matrix @python

题目Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example, Given the following matrix:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] You

2016-01-18 21:27:37 1318

原创 [Leetcode] 50. Pow(x, n) @python

题目Implement pow(x, n).题目要求实现x的n次幂。解题思路此题参考南郭子綦 自己想了很久,没想到用这么几行代码就搞定了。 采用递归来实现二分。分以下四种情况考虑: 1. n ==0 ,返回1.0 2. n < 0, 返回1/pow(x,-n) 3. n % 2 == 0,返回pow(x*x,n/2) 4. n % 2 == 1,返回pow(x*x,n/2) * x$代码

2016-01-18 20:58:37 735

原创 [Deeplearning]RBM-hinton代码解读

解读hintonRBM的matlab实现关于RBM(受限波尔玆曼机)受限波尔玆曼机是生成式模型。输入数据可以根据概率生成出来。 RBM通常用contrastive divergence来进行训练,这是Hinton在2002年提出来的。将在后续的博文中对其进行介绍。 RBM由两层组成,一层可见层,一层隐藏层。由隐藏层对可见层数据进行特征提取。可见层可以为二值或实数值,隐藏层为二值。网络的能量由以下

2016-01-18 13:49:47 5186 2

原创 [Leetcode]43. Multiply Strings @python

题目Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-negative.题目要求给定两个用字符串表示的数字,进行乘法运算,并且返回结果用字符串表示。解题思路先将

2016-01-17 13:12:47 1191

原创 [Leetcode]36. Valid Sudoku@python

题目Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. A partially filled sudoku

2016-01-17 12:13:06 449

原创 [Leetcode]32. Longest Valid Parentheses @python

题目Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which h

2016-01-17 11:30:43 1011

原创 [Leetcode] 15.3Sum @python

题目Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: Elements in a triplet (a,b,c) must be

2016-01-16 23:16:51 269

原创 [Leetcode]30. Substring with Concatenation of All Words @python

题目You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and w

2016-01-16 22:19:45 1020

原创 [Leetcode]29. Divide Two Integers @python

题目Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.题目要求除法运算,但是不能用编程语言提供的乘法、除法和取模运算,即只能用加法和减法实现。为了加速运算,可以依次将被除数减去1,2,4,8,..倍的除数。所以这里可以用移位来进一步

2016-01-16 16:48:08 1570

原创 [Leetcode]23. Merge k Sorted Lists @python

题目Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.题目要求将k个有序的列表组合成一个大的有序列表,并分析实现的复杂度解题思路此题参考kitt blog,使用小根堆结构进行实现。 先将所有列表按照第一个元素的大小放入小根堆中,然后每次取回最小的元素的列

2016-01-16 15:32:14 1786

原创 [Leetcode]10. Regular Expression Matching @python

题目Implement regular expression matching with support for ‘.’ and ‘*’.‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element.The matching should cover the entire input stri

2016-01-16 12:20:06 1352

翻译 [DeepLearning]Unsupervised feature learning for audio classification using convolutional deep belief

题目解读使用卷积深度可信网络以非监督的方式学习语音数据的特征,用学习到的特征进行分类文章特点无监督使用卷积受限玻尔玆曼机多层(深度)网络摘要第一个使用深度学习的方式处理音频数据。 使用卷积深度可信网络无监督提取音频特征 使用提取的音频特征进行了多种不同的语音分类任务简介![深度可信网络][4]是一种生成式概率模型,包含一个可见层和多个隐藏层。每个隐藏层的单元学习底层单元的统计关系。可以通

2016-01-13 18:36:22 737

原创 [Leetcode]6. ZigZag Conversion @python

题目The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N

2016-01-13 00:32:16 1636

原创 [Leetcode]5.Longest Palindromic Substring @ Python

题目Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.题目要求给定一个字符串s,找出字符串s中最大的回文

2016-01-12 20:33:49 239

原创 [Leetcode]4. Median of Two Sorted Arrays @python

题目There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).题目要求有两个排好序的数组nums1,nums2,找到这

2016-01-12 20:03:48 446

原创 [Leetcode]3. Longest Substring Without Repeating Characters @python

题目Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for “abcabcbb” is “abc”, which the length is 3. For

2016-01-12 19:05:20 396

原创 [Leetcode]2.Add Two Numbers @python

题目You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a lin

2016-01-11 21:06:28 230

原创 [Leetcode] 1.Two Sum @python

[Leetcode] Two Sum @python题目Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they ad

2016-01-11 20:24:27 354

空空如也

空空如也

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

TA关注的人

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