- 博客(86)
- 收藏
- 关注
原创 《机器学习实战》第五章:Logistic回归(2)随机梯度上升和一个实例
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:50 6084 15
原创 《机器学习实战》第五章:Logistic回归(1)基本概念和简单实例
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:48 7758 15
原创 《机器学习实战》第四章:朴素贝叶斯(2)两个实例
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:45 2623 1
原创 《机器学习实战》第四章:朴素贝叶斯(1)基本概念和文本分类
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:42 2209 2
原创 《机器学习实战》第三章:决策树(3)测试、存储、实例
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:40 6034 3
原创 《机器学习实战》第三章:决策树(2)树的构造
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:37 1480 1
原创 《机器学习实战》第三章:决策树(1)基本概念
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:33 2388
原创 《机器学习实战》第二章:k-近邻算法(3)手写数字识别
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:29 998
原创 《机器学习实战》第二章:k-近邻算法(2)约会对象分类
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:26 1603 2
原创 《机器学习实战》第二章:k-近邻算法(1)简单KNN
1. CH2-kNN(1) 2. CH2-kNN(2)3. CH2-kNN(3)4. CH3-决策树(1) 5. CH3-决策树(2)6. CH3-决策树(3)7. CH4-朴素贝叶斯(1)8. CH4-朴素贝叶斯(2)9. CH5-Logistic回归(1)10. CH5-Logistic回归(2)======== No More========...
2019-05-05 21:34:21 1260
原创 [Leetcode] Sum Root to Leaf Numbers
题目链接在此Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Fin
2017-03-14 20:11:00 435
原创 [Leetcode] Convert Sorted Array to Binary Search Tree
题目链接在此Given an array where elements are sorted in ascending order, convert it to a height balanced BST.基于一个有序数组,建立BST。直观的做法:取数组中点作为根,左侧数组作为左子树,右侧数组作为右子树,不断递归地建树。class Solution {publ
2017-03-14 19:59:29 326
原创 [Leetcode] Validate Binary Search Tree & Recover Binary Search Tree
这是两道题。98. Validate Binary Search Tree99. Recover Binary Search Tree98题:判断一棵树是不是合法的二叉搜索树(BST)。BST有个可以用脚后跟想出来的特点:中序遍历可以得到一个递增的序列。那我们就中序遍历,看看他是不是严格递增 就可以了。那么怎样做到不开辟新的空间呢?用一个last
2017-03-14 19:35:13 380
原创 [Leetcode] Binary Tree Level Order Traversal & Binary Tree Zigzag Level Order Traversal
这是两道题:102. Binary Tree Level Order Traversal103. Binary Tree Zigzag Level Order Traversal102这道题就是按层次遍历,但是要把每一层的节点分别存储到vector里面去。两年前就做过这道题,还写了博客。当时的做法是硬生生地给每个结点加了个域,用来标记高度。很蹩脚。今天做10
2017-03-14 18:29:13 377
原创 [Leetcode] Wildcard Matching
题目链接在此。Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matchi
2017-03-13 16:02:30 464
原创 [Leetcode] 3Sum
题目链接在此。上古老题。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: The sol
2017-03-13 04:26:22 433
原创 [Leetcode] Rotate Image
题目链接在此You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:Could you do this in-place?把一个n x n的2D矩阵逆时针旋转90度,不用额外空间。
2017-03-13 04:00:29 306
原创 [Leetcode] Search in Rotated Sorted Array
原题链接在此Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to
2017-03-03 15:30:21 320
转载 [Leetcode] Flatten Binary Tree to Linked List
题目链接在此Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look lik
2017-03-02 19:37:41 258
转载 [Leetcode] Container With Most Water
题目链接在此Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (
2017-03-01 19:49:55 307
原创 [Leetcode] Swap Nodes in Pairs & Reverse Nodes in k-Group
这是两道题。24. Swap Nodes in Pairs : 把链表两两相邻的结点互换值。25. Reverse Nodes in k-Group : 把链表中每k个结点组成的子链表翻转。其实24就是25在k=2时候的情况。就只讲25吧。Given a linked list, reverse the nodes of a linked list k at
2017-02-27 20:43:20 310
转载 (位运算总结)A summary: how to use bit manipulation to solve problems easily and efficiently
原帖在此WIKIBit manipulation is the act of algorithmically manipulating bits or other pieces of data shorter than a word. Computer programming tasks that require bit manipulation include l
2017-02-17 11:40:40 994
转载 [LeetCode] Sum of Two Integers(用位运算实现加法)
题目链接在此Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.要求代码里不能出现 + 和 - 符号,只能用位运算咯。这位大神把加法、
2017-02-17 11:32:56 533
原创 [LeetCode] Next Greater Element I
题目链接在此You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the correspondin
2017-02-16 23:33:09 347
原创 [LeetCode] Find All Numbers Disappeared in an Array
题目链接在此Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in thi
2017-02-16 21:33:07 277
原创 [LeetCode] Hamming Distance(二进制中有多少个1)+ Number Complement(补码)
啊,又是好久没来了!最近又开始刷leetcode,发现题目多了不少。还是从基础开始做吧。这里是两道关于位运算的题。1. Hamming Distance题目链接在此The Hamming distance between two integers is the number of positions at which the corresponding
2017-02-16 18:35:54 410
原创 C++ map和set中的结构体
哇,好久没来写博客了。今天是发现了一个新大陆。是这样的,我想随机生成一些整数对(x,y),然后需要判断一堆数在之前又没生成过。直观的做法是弄一个bool型的二维数组,但是这样太耗费空间了,容易造成浪费。于是我们想把每个整数对放在一个结构体里,然后将结构体作为map的key,将一个bool型作为map的value。这样建立一个映射的关系,来判断整数对是否出现过。于是一开始我就这样
2015-12-29 22:01:56 1976
原创 Sicily. 八皇后问题
Description给定一个8*8棋盘,要求在棋盘上放8个皇后,并且各个皇后之间不能相互攻击。 当两个皇后位于同一行或同一列或同一对角线(有两条)就会相互攻击。 现在要求大家编程输出8皇后问题的所有解。 注意:皇后是逐行放的,也就要求输出每一行放皇后的列号的序列,行号和列号都是从1开始的Input无Output每一行输出一个解决方案
2015-11-02 17:02:56 961
转载 [LeetCode] Permutations I, II
转自这位大神。啥也不说了,看了大神的代码,感觉就像柯南破案的时候,脑袋中有一道闪电划过一样。Permutations I题目链接在此Given a collection of numbers, return all possible permutations.For example,[1,2,3] ha
2015-10-30 22:16:14 469
原创 [Leetcode] Combinations
题目链接在此Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4], [2,3], [1,2], [
2015-10-28 11:48:23 324
原创 [Leetcode] Subsets
题目链接在此Given a set of distinct integers, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subs
2015-10-23 16:05:24 389
原创 sicily. 放鸡蛋(输出情况总数+输出具体情况)
Time Limit: 1sec Memory Limit:256MBDescription 把M个同样的鸡蛋放在N个同样的篮子里,允许有的篮子空着不放,问共有多少种不同的放法?5,1,1和1,5,1是同一种分法。Input 第一行是测试数据的数目t(0 )。以下每行均包含二个整数M和N,以空格分开。1,N。Output对输入的每组
2015-10-10 22:27:19 915
转载 Sicily. 整数划分
Description对于一个整数m,m > 0,它可以写成t个整数的和的形式(t>0):m = z1 + z2 + … + zt ,其中zi > 0且为整数(1≤i≤t)这t个整数就是整数m的一种划分。比如整数4有以下5种划分:43+12+22+1+11+1+1+1Input第一行是一个整数n,代表有n个测试用例接下来的n行每一
2015-10-10 22:13:33 934
转载 Sicily. 全排序输出
输入一个数字n,输出从1~n组成的数字的全排列,每个排列占一行,输出按照数值升序排列比如输入3,则输出是:123132213231312321递归算法。转自这位大神#include#includeusing namespace std;void permutation(string pre, string rem
2015-10-10 15:27:50 604
原创 Sicily. 完整计算器(浮点数;四则运算与括号)
Time Limit: 1sec Memory Limit:256MBDescription 请实现一个只包含加减乘除以及括号运算的简单计算器,忽略式子中的所有空格,输入格式是正确的,不需要判断。Input 第一行只有一个整数m,代表有m个测试用例接下来有m行,每一行是一个测试用例,代表要求计算的式子,请注意输入的数字可能有小数。
2015-10-09 17:24:11 2960
转载 [LeetCode] Move Zeroes
题目链接在此转自这位大神题目描述:Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.For example, given nums = [0, 1,
2015-10-08 14:14:13 345
原创 Sicily. 迷宫最短路径
Time Limit: 1sec Memory Limit:256MBDescription有一个矩形迷宫,入口和出口都确定为唯一的,且分布在矩形的不同边上。现在让你算出最短需要走多少步,才可以从入口走到出口。Input共N+1行,第一行为N(N=0表示输入结束),以下N行N列0-1矩阵,1表示不能通过,0表示可以通过(左上角和右下角为0,即入口和出口),
2015-10-07 21:55:40 1658
原创 Sicily 1151. 魔板
题目链接在此经典的状态转换搜索题。一.原题中文大意(1)描述魔板由8个大小相同方块组成,分别用涂上不同颜色,用1到8的数字表示。其初始状态是:1 2 3 48 7 6 5对魔板可进行三种基本操作:A操作(上下行互换):8 7 6 51 2 3 4B操作(每次以行循环右移一个):4 1 2 35 8 7 6C操作(中间四小块顺时针转
2015-10-07 19:24:11 701
原创 [Leetcode] Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has on
2015-10-07 19:11:59 387
转载 [leetcode] Implement strStr()
题目链接在此Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.模式匹配。KMP咯。说起KMP的话,自从大一上学C语言开始就有所了解,但是只知道它的用途和大概原理,从没下过功夫落实
2015-08-13 11:22:20 425
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人