自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

专注于机器学习,深度学习,人脸识别领域。

北大硕士,18年毕业,找工作中。。。

  • 博客(38)
  • 资源 (1)
  • 收藏
  • 关注

原创 在matlab2014b和cuda8.0的条件下编译MatConvNet

由于做实验用到了matconvnet,而实验室的机子安装的版本是cuda8.0,在编译matconvnet的gpu版本时,遇到了error: function “atomicAdd(double *, double)” has already been defined这个错误。 这个错误的产生是cuda8.0里面也定义了这个函数,所以出现了冲突。 解决方法是 如果MatConvNet版本在b

2017-04-24 12:02:14 2723 1

原创 线性回归与逻辑斯提回归的区别

线性回归和逻辑斯提回归都是线性模型,虽然逻辑斯提回归是加了sigmoid函数,引入了非线性,但是它本质上还是只能解决非线性问题的。 两者的区别本质上,线性回归是做回归的,回归出y=wx+b的w,b。lr是做分类的,得到置信度。其实lr就是在线性回归基础上加上了sigmoid函数,然后通过sgd,拟牛顿法等方法得到1/(1+exp(z));z=wx+b; 里面的w,b。

2017-04-15 17:29:37 1598

原创 利用kd树进行平面内最近点搜索

要求: 对平面内每一个点都找到离它最近的点。通常想法是knn,那么由于是对n个点求,直接算的话就是n平方。我们利用kd树来搜索,那么复杂度就变为了nlogn,甚至说由于a与b距离最小等价于b与a最小,我们可以减少到(nlogn)/2;建树: 对于一个二维空间的一堆点,首先对第一维考虑,找到第一维的中位数,按照中位数划分为两部分。小的放在左子树,大的放在右子树。然后按照第二维来划分,再建树,再按照

2017-04-13 17:18:33 1167

原创 355. Design Twitter(unsolved)

Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most recent tweets in the user’s news feed. Your design should support the fol

2017-04-12 22:11:32 277

原创 241. Different Ways to Add Parentheses(unsolved)

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Example 1 Input:

2017-04-12 20:58:38 335

转载 139. Word Break(unsolved)

Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. You may assum

2017-04-12 17:07:45 241

原创 213. House Robber II(unsolved)

Note: This is an extension of House Robber.After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all

2017-04-12 15:39:04 183

转载 309. Best Time to Buy and Sell Stock with Cooldown(unsolved)

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 (ie, buy one and

2017-04-12 15:21:20 262

原创 304. Range Sum Query 2D - Immutable(unsolved)

Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).Range Sum Query 2D The above rectangle (wi

2017-04-12 15:03:53 298

原创 150. Evaluate Reverse Polish Notation(unsolved)

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: [“2”, “1”, “+”, “3”, ““]

2017-04-11 16:41:02 194

原创 322. Coin Change(unsolved)

You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money c

2017-04-11 12:18:52 199

原创 221. Maximal Square(unsolved)

Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.For example, given the following matrix:1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 0 Ret

2017-04-11 12:02:40 257

原创 394. Decode String(unsolved)

Given an encoded string, return it’s decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note that k is guaran

2017-04-10 23:41:47 287

原创 331. Verify Preorder Serialization of a Binary Tree(unsolved)

One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node’s value. If it is a null node, we record using a sentinel value such as #. _9_/

2017-04-09 22:24:36 215

原创 201. Bitwise AND of Numbers Range(unsolved)

Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.For example, given the range [5, 7], you should return 4.解答: 仔细观察规律,发现从m到n的所有数中,保留下

2017-04-09 21:22:40 194

原创 279. Perfect Squares(unsolved)

Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n.For example, given n = 12, return 3 because 12 = 4 + 4 + 4; given n = 13, return

2017-04-09 20:52:03 231

原创 313. Super Ugly Number(unsolved)

Write a program to find the nth super ugly number.Super ugly numbers are positive numbers whose all prime factors are in the given prime list primes of size k. For example, [1, 2, 4, 7, 8, 13, 14, 16,

2017-04-09 18:44:34 257

原创 373. Find K Pairs with Smallest Sums(unsolved)

You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k.Define a pair (u,v) which consists of one element from the first array and one element from the second array.

2017-04-08 18:34:45 217

原创 376. Wiggle Subsequence(unsolved)

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either posi

2017-04-08 17:47:24 148

原创 134. Gas Station(unsolved)

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to its nex

2017-04-08 16:40:26 503

原创 264. Ugly Number II(unsolved)

Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ugly

2017-04-07 00:24:06 400

原创 200. Number of Islands(unsolved)

Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume

2017-04-06 23:16:48 428

原创 130. Surrounded Regions(unsolved)

Given a 2D board containing ‘X’ and ‘O’ (the letter 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 X X O O

2017-04-06 22:15:44 425

原创 324. Wiggle Sort II(unsolved)

Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]….Example: (1) Given nums = [1, 5, 1, 1, 6, 4], one possible answer is [1, 4, 1, 5, 1, 6]. (2) Given nums = [1

2017-04-05 19:13:57 427

原创 382. Linked List Random Node(unsolved)

Given a singly linked list, return a random node’s value from the linked list. Each node must have the same probability of being chosen.Follow up: What if the linked list is extremely large and its le

2017-04-05 18:51:02 191

原创 384. Shuffle an Array(unsolved)

Shuffle a set of numbers without duplicates.Example:// Init an array with set 1, 2, and 3. int[] nums = {1,2,3}; Solution solution = new Solution(nums);// Shuffle the array [1,2,3] and return its res

2017-04-05 18:00:22 245

原创 398. Random Pick Index(unsolved)

Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.Note: The array size can be

2017-04-05 17:25:16 354

原创 179. Largest Number(unsolved)

Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be very large,

2017-04-05 16:21:18 305

原创 274. H-Indexun(solved)

Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index.According to the definition of h-index on Wikipedia: “A scien

2017-04-04 16:45:16 264

原创 240. Search a 2D Matrix II(unsolved)

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right. Integers in each co

2017-04-04 16:07:21 253

原创 50. Pow(x, n)(unsolved)

Implement pow(x, n).解答: 这道题其实不难,主要用到除以二,然后递归, 值得注意的有两点 1.奇数除以二和奇数减一除以二是等价的,所以无需减去1. 2.要用边界终止条件 if(n==0) return 1; 而非 if(n==1) return x; 因为假如n为INT_MIN,那么-n就超出最大的int值了,我们打印出来发现,-n输入进去后还是-21474836

2017-04-04 15:19:57 363

原创 367. Valid Perfect Square(unsolved)

Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.Example 1:Input: 16 Returns: True E

2017-04-04 13:27:21 270

原创 69. Sqrt(x) (unsolved)

Implement int sqrt(int x).Compute and return the square root of x.解答: 二分查找,计算left,right,mid,然后mid的平方==x就行,主要还得一个个试class Solution {public: int mySqrt(int x) { if(x==0) return 0; lo

2017-04-04 12:59:58 261

原创 300. Longest Increasing Subsequence(unsolved)

Given an unsorted array of integers, find the length of longest increasing subsequence.For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 101], therefore

2017-04-04 12:42:47 214

转载 C/C++中static关键字作用总结

转载自华山大师兄1.先来介绍它的第一条也是最重要的一条:隐藏。(static函数,static变量均可)当同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全局可见性。 举例来说明。同时编译两个源文件,一个是a.c,另一个是main.c。//a.c char a = ‘A’; // global variable void msg() {

2017-04-04 12:35:29 188

原创 79. Word Search(unsolved)

Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or vertically neig

2017-04-01 14:21:05 149

原创 63. Unique Paths II(unsolved)

Follow up for “Unique Paths”:Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and 0 respectively in the grid.For ex

2017-04-01 13:22:51 307

原创 31. Next Permutation(unsolved)

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest possible orde

2017-04-01 12:17:26 197

空空如也

空空如也

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

TA关注的人

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