自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(52)
  • 资源 (4)
  • 收藏
  • 关注

原创 将二维ndarrary按照某一列的值进行排序

import numpy as npimport cv2import matplotlib.pyplot as pltdata_file = "all_data.txt"dataarr = np.loadtxt(data_file, str)sortrow = dataarr[:,180]sortrow = sortrow.astype(float)dataarr = da...

2018-08-17 16:51:57 465

原创 算法设计与复杂性 Raid

总时间限制: 1000ms 内存限制: 65536kB描述After successive failures in the battles against the Union, the Empire retreated to its last stronghold. Depending on its powerful defense system, the Em

2018-01-07 12:58:59 319

原创 算法设计与复杂性 第四次上机 LITTLE SHOP OF FLOWERS

总时间限制: 1000ms 内存限制: 65536kB描述You want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each being of a different kind, and at least as many

2018-01-06 20:18:08 259

原创 算法设计与复杂性 第五次上机 Arbitrage

总时间限制: 1000ms 内存限制: 65536kB描述Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example,

2018-01-06 18:39:01 224

原创 算法设计与复杂度 模拟考 Palindrome

总时间限制: 3000ms 内存限制: 65536kB描述A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a

2017-12-29 17:31:43 281

原创 算法设计与复杂性 模拟 to europe

总时间限制: 1000ms 内存限制: 65536kB描述Almost everyone in the candidate states wants to `go to Europe'', although most of the people have very vague ideas about what this actually means. Anyway, immediate

2017-12-28 16:05:12 264

原创 算法设计与分析 模拟考 Percolation

总时间限制: 1000ms 内存限制: 32768kB描述定义一个N行N列的矩阵,矩阵中的每个元素是个方格,每个方格有两种可能的状态:开通的或关闭的。初始时,所有方格都是关闭的。输入数据的每一步会指定矩阵中某个原来关闭的方格变成开通的。要求编写程序判断当前是否存在从矩阵中最上面一行的任何一个开着的方格走到最下面一行的任何一个开着的方格的路径。如果存在的话,输出当前的步数。比如走

2017-12-14 16:32:28 1083

原创 算法设计与分析 模拟考 radar installation

总时间限制: 1000ms 内存限制: 65536kB描述Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any r

2017-12-14 15:46:31 234

原创 算法设计与复杂性分析 第二次上机 Dynamic Median

总时间限制: 3000ms 内存限制: 65536kB描述设计一个数据结构,初始为空,支持以下操作:(1)增加一个元素,要求在log(n)时间内完成,其中n是该数据结构中当前元素的个数。注意:数据结构中允许有重复的元素。(2)返回当前元素集合的中位数,要求在常数时间内完成。如果当前元素的个数为偶数,那么返回下中位数(即两个中位数中较小的一个)。(3)删除

2017-11-07 15:49:23 439

原创 算法分析 第二次上机 Butterfly

可以使用bfs与并查集。注意bfs使用时,压入队列的数值要标为已访问,否则会导致节点多次压入队列,造成TTL。#include #include #include #include #include using namespace std;int relation[1005][1005];bool visited[1005];bool type[1005

2017-11-07 15:49:11 453

原创 算法分析 第二次上机 Yogurt factory

总时间限制: 1000ms 内存限制: 65536kB描述The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk and labor will fluctuate w

2017-11-07 15:48:52 225

原创 算法设计 第二次上机 The Unique MST

总时间限制: 1000ms 内存限制: 65536kB描述Given a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E).

2017-11-07 15:48:39 191

原创 算法设计 第二次上机 Subway

总时间限制: 1000ms 内存限制: 65536kB描述You have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take

2017-11-07 15:48:27 163

原创 算法设计 第二次上机 All discs considered

总时间限制: 10000ms 内存限制: 65536kB描述Operating systems are large software artefacts composed of many packages, usually distributed on several media, e.g., discs. You probably remember the time when you

2017-11-07 15:48:04 243

原创 priority_queue C++

优先队列包含在头函数中。默认从大到小排列,可以使用priority_queue, greater>来定义从小到大排序的int优先队列。其中,对比函数可以通过实现自定义operator包含函数有:size():返回int值,当前队列大小。empty():返回bool值,当前队列是否为空。push(T t):压入类型为T的实例t入队列。pop():返回值为空,弹出一个元素。

2017-10-20 15:52:34 195

原创 算法分析与复杂性理论 第一次上机 2的幂次方表示

总时间限制: 1000ms 内存限制: 65536kB描述任何一个正整数都可以用2的幂次方表示。例如:    137=27+23+20同时约定方次用括号来表示,即ab可表示为a(b)。由此可知,137可表示为:    2(7)+2(3)+2(0)进一步:7=22+2+20(21用2表示)        3=2+20所以最后137可

2017-09-16 11:17:10 223

原创 算法设计与复杂性理论 第一次上机 仙岛求药

总时间限制: 1000ms 内存限制: 65536kB描述少年李逍遥的婶婶病了,王小虎介绍他去一趟仙灵岛,向仙女姐姐要仙丹救婶婶。叛逆但孝顺的李逍遥闯进了仙灵岛,克服了千险万难来到岛的中心,发现仙药摆在了迷阵的深处。迷阵由M×N个方格组成,有的方格内有可以瞬秒李逍遥的怪物,而有的方格内则是安全。现在李逍遥想尽快找到仙药,显然他应避开有怪物的方格,并经过最少的方格,而且那里会有神秘人物等

2017-09-15 23:24:42 357

原创 算法分析与复杂性理论 第三题 Til the Cows Come Home

总时间限制: 1000ms 内存限制: 65536kB描述Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her

2017-09-15 21:18:01 260

原创 算法分析与复杂性原理 第一次上机 二叉树的操作

总时间限制: 1000ms 内存限制: 65535kB描述给定一棵二叉树,在二叉树上执行两个操作:1. 节点交换把二叉树的两个节点交换。2. 前驱询问询问二叉树的一个节点对应的子树最左边的节点。输入第一行输出一个整数t(t 对于每组测试数据,第一行输入两个整数n m,n代表二叉树节点的个数,m代表操作的次数。随后输入n行,每行包含

2017-09-15 16:18:08 406

原创 算法分析与复杂性原理 第一次上机 棋盘问题

总时间限制: 1000ms 内存限制: 65536kB描述在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。输入输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及

2017-09-14 20:24:43 242

原创 算法设计与复杂性原理 第一次上机 玛雅历

总时间限制: 1000ms 内存限制: 65536kB描述上周末,M.A. Ya教授对古老的玛雅有了一个重大发现。从一个古老的节绳(玛雅人用于记事的工具)中,教授发现玛雅人使用了一个一年有365天的叫做Haab的历法。这个Haab历法拥有19个月,在开始的18个月,一个月有20天,月份的名字分别是pop, no, zip, zotz, tzec, xul, yoxkin, mo

2017-09-14 20:21:27 340

原创 java string类型split函数

String提供方法split(String),返回String[]类型。String str = "1|2|5|3|4"; String[] id = str.split("|"); boolean[] gen = new boolean[20]; for(int i = 1; i < id.length; i+=2) { //System.out.println(id

2017-04-18 13:36:56 383

原创 使用myeclipse读取excel文件写入mysql数据库

一、使用poi包读取excel的cell时,整数会被转换为浮点数,即表格中数据为1的cell,读取的HSSFCell.toString()是1.0的格式,需要使用replaceAll(".0","")将.0去掉,或者使用(int)HSSFCell.getNumericCellValue()将得到的数据强行转换成整数。二、对于使用PreparedStatement时,对?位置进行赋值时,赋值为n

2017-03-27 20:43:40 1370

原创 python入门——笔记1

通过阅读《”笨方法“学python(第三版)》,书写的很细很简单,适合没有编程基础的人自学python。因为我用的python3,书中的介绍是用的python2,所以有些地方有些偏差。使用Notepad++以及cmd命令行用做python代码编写及运行。

2017-03-24 22:03:36 273

原创 欧式空间

设V是实数域R上的线性空间(或称为向量空间),若V上定义着正定对称双线性型g(g称为内积),则V称为(对于g的)内积空间或欧几里德空间(有时仅当V是有限维时,才称为欧几里德空间)。具体来说,g是V上的二元实值函数,满足如下关系:(1)对称性:g(x,y)=g(y,x);(2)加性:g(x+y,z)=g(x,z)+g(y,z);(3)齐次性:g(kx,y)=kg(x,y);

2016-11-01 12:57:55 1413

原创 保研历程

终于尘埃落定了。最后录取了北大信科。决定把自己这几个月的保研历程记录下来。一、个人情况其实吧,我的个人情况很一般。末流985,专业软件工程,大一下学期选入工科试验班。成绩排名1/30,综合排名2/30。论文是在七月末水了一篇,不是第一作者。竞赛全无,只有奖学金,社会奖学金一直没有申请过,实习经历无。面试机试笔试一直都是裸考,从来没准备过,这里也吃了很大的亏。大多数offer都是九月份拿到的

2016-09-28 16:02:03 5370 3

原创 九度1040

#include #include #include #include #include #include #include using namespace std;bool isPrime(int n){ for(int i=2;i<=sqrt(n);i++) if(n%i==0) return false; retu

2016-09-24 21:29:03 328

原创 九度1099

#include #include #include #include #include #include using namespace std;int cmp(const void* a,const void *b){ return strcmp((char*)a,(char*)b);}int main(){ string str; char

2016-09-24 21:23:49 230

原创 九度1104

注意多组数据输入#include #include #include #include #include #include #include using namespace std;int main(){ int n,a; while(cin>>n>>a) { int cnt=0; long long int res

2016-09-24 15:40:06 192

原创 九度1092

fibonacci数列,水题#include #include #include #include #include #include #include using namespace std;int main(){ int n; int fib[35]; fib[0]=0; fib[1]=1; for(int i=2;i<=30;

2016-09-24 14:41:50 210

原创 北大机试最小生成树

哎。。。策略错误。。。最小生成树竟然没写完。。。。就差一点就ac五道了T_T#include #include #include #include #include #include #include using namespace std;struct path{ int name1; int name2; float pathl;};fl

2016-09-24 00:29:47 251

转载 商人的宣传 矩阵乘法

商人的宣传DescriptionBruce是K国的商人,他在A州成立了自己的公司,这次他的公司生产出了一批性能很好的产品,准备宣传活动开始后的第L天到达B州进行新产品拍卖,期间Bruce打算将产品拿到各个州去做推销宣传,以增加其影响力。K国有很多个州,每个州都与其他州相邻,但是K国对商人作宣传却有一些很奇怪的规定:1、商人只能从某些州到达另外一些州,即连通路线是单向的,而且

2016-09-19 07:59:42 591

原创 九度1081矩阵二分法

再次分析题目,会发现递推公式进而推出问题转化为求这里要用到 矩阵二分乘法。矩阵二分乘法是一种有效的快速计算矩阵幂的算法。矩阵二分乘法通常可以将线性递推问题O(n)时间缩短到O(log(n))。#include #include #include #include usi

2016-09-18 23:15:42 315

原创 九度1080

超时#include #include #include #include using namespace std;int main(){ int n,m; string str; string result; while(cin>>m>>n) { cin>>str; result.clear();

2016-09-18 22:14:08 247

转载 C++中string类的基本函数

要想使用标准C++中string类,必须要包含#include // 注意是,不是,带.h的是C语言中的头文件using std::string;using std::wstring;或using namespace std;下面你就可以使用string/wstring了,它们两分别对应着char和wchar_t。string和wstring的用法是一样的,以下只用string作

2016-09-18 21:28:03 319

转载 c++ string 的函数replace()用法

basic_string::max_size 返回string 能放的最大元素个数。(不同于capacity) size _ type max _ size( ) const; basic_string ::size_type cap, max; cap = s.capacity ( ); max = s.max_size ( ); // max=42949

2016-09-18 21:10:48 658

原创 九度1077 最大子序列和

dp[i]=max{dp[i-1]+value[i],value[i]}包含第i个元素的长为i的子序列最大和。

2016-09-18 18:24:37 203

原创 九度1082

C实现#include #include #include int main(){ char agency[1005][16]; char server[2005][16]; int n,m; int i,j; int flag; int res; int start; int maxl; while(~scan

2016-09-18 18:23:22 197

转载 最长公共子串、最长公共子序列、最长回文子串、模式匹配、最大子序列--字符串问题整理

一.最长公共子串问题集(Longest Common Substring/LCS)    最长公共子串问题的基本表述为:    给定两个字符串,求出它们之间最长的相同子字符串的长度。    最直接的解法自然是找出两个字符串的所有子字符串进行比较看他们是否相同,然后取得相同最长的那个。对于一个长度为n的字符串,它有n(n+1)/2 个非空子串。所 以假如两个字符串的长度同为n,通

2016-09-18 16:45:26 707

原创 九度1079

暴力。可以用数组记录每个键上第一个字母,减少代码量。#include #include #include #include #include #include #include #include using namespace std;int gettime(char c){ if(c-'a'<15) { switch((c-'a')%3

2016-09-17 23:44:52 201

The Elements of Statistical Learning:Data Mining, Inference, and Prediction

The Elements of Statistical Learning:Data Mining, Inference, and Prediction Trevor Hastie,Robert Tibshirani,Jerome Friedman

2017-10-06

统计学习方法 李航 清华大学出版社

统计学习方法 李航著 清华大学出版社 机器学习入门书籍

2017-09-30

Foundations of Data Science,Avrim Blum, John Hopcroft and Ravindran Kannan著

Foundations of Data Scienceby Avrim Blum, John Hopcroft and Ravindran Kannan 数据科学导论 Contents 1 Introduction 8 2 High-Dimensional Space 11 2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2 The Law of Large Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.3 The Geometry of High Dimensions . . . . . . . . . . . . . . . . . . . . . . 14 2.4 Properties of the Unit Ball . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.4.1 Volume of the Unit Ball . . . . . . . . . . . . . . . . . . . . . . . . 15 2.4.2 Most of the Volume is Near the Equator . . . . . . . . . . . . . . . 17 2.5 Generating Points Uniformly at Random from a Ball . . . . . . . . . . . . 20 2.6 Gaussians in High Dimension . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.7 Random Projection and Johnson-Lindenstrauss Lemma . . . . . . . . . . . 23 2.8 Separating Gaussians . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 2.9 Fitting a Single Spherical Gaussian to Data . . . . . . . . . . . . . . . . . 27 2.10 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 2.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3 Best-Fit Subspaces and Singular Value Decomposition (SVD) 38 3.1 Introduction and Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.3 Singular Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 3.4 Singular Value Decomposition (SVD) . . . . . . . . . . . . . . . . . . . . . 44 3.5 Best Rank-k Approximations . . . . . . . . . . . . . . . . . . . . . . . . . 45 3.6 Left Singular Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.7 Power Method for Computing the Singular Value Decomposition . . . . . . 49 3.7.1 A Faster Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 3.8 Singular Vectors and Eigenvectors . . . . . . . . . . . . . . . . . . . . . . . 52 3.9 Applications of Singular Value Decomposition . . . . . . . . . . . . . . . . 52 3.9.1 Centering Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 3.9.2 Principal Component Analysis . . . . . . . . . . . . . . . . . . . . . 53 3.9.3 Clustering a Mixture of Spherical Gaussians . . . . . . . . . . . . . 54 3.9.4 Ranking Documents and Web Pages . . . . . . . . . . . . . . . . . 59 3.9.5 An Application of SVD to a Discrete Optimization Problem . . . . 60 3.10 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 3.11 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 4 Random Graphs 71 4.1 The G(n; p) Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 4.1.1 Degree Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 4.1.2 Existence of Triangles in G(n; d=n) . . . . . . . . . . . . . . . . . . 77 4.2 Phase Transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 4.3 The Giant Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 2 4.4 Branching Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 4.5 Cycles and Full Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . 102 4.5.1 Emergence of Cycles . . . . . . . . . . . . . . . . . . . . . . . . . . 102 4.5.2 Full Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 4.5.3 Threshold for O(ln n) Diameter . . . . . . . . . . . . . . . . . . . . 105 4.6 Phase Transitions for Increasing Properties . . . . . . . . . . . . . . . . . . 107 4.7 Phase Transitions for CNF-sat . . . . . . . . . . . . . . . . . . . . . . . . . 109 4.8 Nonuniform and Growth Models of Random Graphs . . . . . . . . . . . . . 114 4.8.1 Nonuniform Models . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.8.2 Giant Component in Random Graphs with Given Degree Distribution114 4.9 Growth Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 4.9.1 Growth Model Without Preferential Attachment . . . . . . . . . . . 116 4.9.2 Growth Model With Preferential Attachment . . . . . . . . . . . . 122 4.10 Small World Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 4.11 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 4.12 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 5 Random Walks and Markov Chains 139 5.1 Stationary Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 5.2 Markov Chain Monte Carlo . . . . . . . . . . . . . . . . . . . . . . . . . . 145 5.2.1 Metropolis-Hasting Algorithm . . . . . . . . . . . . . . . . . . . . . 146 5.2.2 Gibbs Sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 5.3 Areas and Volumes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 5.4 Convergence of Random Walks on Undirected Graphs . . . . . . . . . . . . 151 5.4.1 Using Normalized Conductance to Prove Convergence . . . . . . . . 157 5.5 Electrical Networks and Random Walks . . . . . . . . . . . . . . . . . . . . 160 5.6 Random Walks on Undirected Graphs with Unit Edge Weights . . . . . . . 164 5.7 Random Walks in Euclidean Space . . . . . . . . . . . . . . . . . . . . . . 171 5.8 The Web as a Markov Chain . . . . . . . . . . . . . . . . . . . . . . . . . . 175 5.9 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 5.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 6 Machine Learning 190 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 6.2 Overtting and Uniform Convergence . . . . . . . . . . . . . . . . . . . . . 192 6.3 Illustrative Examples and Occam's Razor . . . . . . . . . . . . . . . . . . . 194 6.3.1 Learning disjunctions . . . . . . . . . . . . . . . . . . . . . . . . . . 194 6.3.2 Occam's razor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 6.3.3 Application: learning decision trees . . . . . . . . . . . . . . . . . . 196 6.4 Regularization: penalizing complexity . . . . . . . . . . . . . . . . . . . . . 197 6.5 Online learning and the Perceptron algorithm . . . . . . . . . . . . . . . . 198 6.5.1 An example: learning disjunctions . . . . . . . . . . . . . . . . . . . 198 6.5.2 The Halving algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 199 3 6.5.3 The Perceptron algorithm . . . . . . . . . . . . . . . . . . . . . . . 199 6.5.4 Extensions: inseparable data and hinge-loss . . . . . . . . . . . . . 201 6.6 Kernel functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 6.7 Online to Batch Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . 204 6.8 Support-Vector Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 6.9 VC-Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 6.9.1 Denitions and Key Theorems . . . . . . . . . . . . . . . . . . . . . 207 6.9.2 Examples: VC-Dimension and Growth Function . . . . . . . . . . . 209 6.9.3 Proof of Main Theorems . . . . . . . . . . . . . . . . . . . . . . . . 211 6.9.4 VC-dimension of combinations of concepts . . . . . . . . . . . . . . 214 6.9.5 Other measures of complexity . . . . . . . . . . . . . . . . . . . . . 214 6.10 Strong and Weak Learning - Boosting . . . . . . . . . . . . . . . . . . . . . 215 6.11 Stochastic Gradient Descent . . . . . . . . . . . . . . . . . . . . . . . . . . 218 6.12 Combining (Sleeping) Expert Advice . . . . . . . . . . . . . . . . . . . . . 220 6.13 Deep learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 6.14 Further Current directions . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 6.14.1 Semi-supervised learning . . . . . . . . . . . . . . . . . . . . . . . . 228 6.14.2 Active learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 6.14.3 Multi-task learning . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 6.15 Bibliographic Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 6.16 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 7 Algorithms for Massive Data Problems: Streaming, Sketching, and Sampling 237 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 7.2 Frequency Moments of Data Streams . . . . . . . . . . . . . . . . . . . . . 238 7.2.1 Number of Distinct Elements in a Data Stream . . . . . . . . . . . 239 7.2.2 Counting the Number of Occurrences of a Given Element. . . . . . 242 7.2.3 Counting Frequent Elements . . . . . . . . . . . . . . . . . . . . . . 243 7.2.4 The Second Moment . . . . . . . . . . . . . . . . . . . . . . . . . . 244 7.3 Matrix Algorithms using Sampling . . . . . . . . . . . . . . . . . . . . . . 247 7.3.1 Matrix Multiplication Using Sampling . . . . . . . . . . . . . . . . 249 7.3.2 Implementing Length Squared Sampling in two passes . . . . . . . . 252 7.3.3 Sketch of a Large Matrix . . . . . . . . . . . . . . . . . . . . . . . . 253 7.4 Sketches of Documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 7.5 Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 7.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 8 Clustering 264 8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 8.1.1 Two general assumptions on the form of clusters . . . . . . . . . . . 265 8.2 k-means Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 8.2.1 A maximum-likelihood motivation for k-means . . . . . . . . . . . . 267 4 8.2.2 Structural properties of the k-means objective . . . . . . . . . . . . 268 8.2.3 Lloyd's k-means clustering algorithm . . . . . . . . . . . . . . . . . 268 8.2.4 Ward's algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 8.2.5 k-means clustering on the line . . . . . . . . . . . . . . . . . . . . . 271 8.3 k-Center Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 8.4 Finding Low-Error Clusterings . . . . . . . . . . . . . . . . . . . . . . . . . 272 8.5 Approximation Stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 8.6 Spectral Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275 8.6.1 Stochastic Block Model . . . . . . . . . . . . . . . . . . . . . . . . . 276 8.6.2 Gaussian Mixture Model . . . . . . . . . . . . . . . . . . . . . . . . 278 8.6.3 Standard Deviation without a stochastic model . . . . . . . . . . . 278 8.6.4 Spectral Clustering Algorithm . . . . . . . . . . . . . . . . . . . . . 279 8.7 High-Density Clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 8.7.1 Single-linkage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 8.7.2 Robust linkage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 8.8 Kernel Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 8.9 Recursive Clustering based on Sparse cuts . . . . . . . . . . . . . . . . . . 283 8.10 Dense Submatrices and Communities . . . . . . . . . . . . . . . . . . . . . 284 8.11 Community Finding and Graph Partitioning . . . . . . . . . . . . . . . . . 287 8.11.1 Flow Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 8.12 Axioms for Clustering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 8.12.1 An Impossibility Result . . . . . . . . . . . . . . . . . . . . . . . . 290 8.12.2 Satisfying two of three . . . . . . . . . . . . . . . . . . . . . . . . . 291 8.12.3 Relaxing the axioms . . . . . . . . . . . . . . . . . . . . . . . . . . 293 8.12.4 A Satisable Set of Axioms . . . . . . . . . . . . . . . . . . . . . . 293 8.13 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 9 Topic Models, Hidden Markov Process, Graphical Models, and Belief Propagation 299 9.1 Topic Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 9.2 Hidden Markov Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 9.3 Graphical Models, and Belief Propagation . . . . . . . . . . . . . . . . . . 308 9.4 Bayesian or Belief Networks . . . . . . . . . . . . . . . . . . . . . . . . . . 308 9.5 Markov Random Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 9.6 Factor Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 9.7 Tree Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 9.8 Message Passing in general Graphs . . . . . . . . . . . . . . . . . . . . . . 313 9.9 Graphs with a Single Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . 315 9.10 Belief Update in Networks with a Single Loop . . . . . . . . . . . . . . . . 316 9.11 Maximum Weight Matching . . . . . . . . . . . . . . . . . . . . . . . . . . 318 9.12 Warning Propagation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 9.13 Correlation Between Variables . . . . . . . . . . . . . . . . . . . . . . . . . 322 9.14 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 5 10 Other Topics 329 10.1 Rankings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 10.2 Hare System for Voting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 10.3 Compressed Sensing and Sparse Vectors . . . . . . . . . . . . . . . . . . . 332 10.3.1 Unique Reconstruction of a Sparse Vector . . . . . . . . . . . . . . 333 10.3.2 The Exact Reconstruction Property . . . . . . . . . . . . . . . . . . 336 10.3.3 Restricted Isometry Property . . . . . . . . . . . . . . . . . . . . . 337 10.4 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 10.4.1 Sparse Vector in Some Coordinate Basis . . . . . . . . . . . . . . . 339 10.4.2 A Representation Cannot be Sparse in Both Time and Frequency Domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340 10.4.3 Biological . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342 10.4.4 Finding Overlapping Cliques or Communities . . . . . . . . . . . . 342 10.4.5 Low Rank Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 10.5 Gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 10.6 Linear Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 10.6.1 The Ellipsoid Algorithm . . . . . . . . . . . . . . . . . . . . . . . . 347 10.7 Integer Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 10.8 Semi-Denite Programming . . . . . . . . . . . . . . . . . . . . . . . . . . 349 10.9 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 11 Wavelets 354 11.1 Dilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 11.2 The Haar Wavelet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 11.3 Wavelet Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 11.4 Solving the Dilation Equation . . . . . . . . . . . . . . . . . . . . . . . . . 359 11.5 Conditions on the Dilation Equation . . . . . . . . . . . . . . . . . . . . . 361 11.6 Derivation of the Wavelets from the Scaling Function . . . . . . . . . . . . 363 11.7 Sucient Conditions for the Wavelets to be Orthogonal . . . . . . . . . . . 367 11.8 Expressing a Function in Terms of Wavelets . . . . . . . . . . . . . . . . . 370 11.9 Designing a Wavelet System . . . . . . . . . . . . . . . . . . . . . . . . . . 371 12 Appendix 375 12.1 Asymptotic Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375 12.2 Useful relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 12.3 Useful Inequalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 12.4 Probability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 12.4.1 Sample Space, Events, Independence . . . . . . . . . . . . . . . . . 388 12.4.2 Linearity of Expectation . . . . . . . . . . . . . . . . . . . . . . . . 389 12.4.3 Union Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 12.4.4 Indicator Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 12.4.5 Variance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 12.4.6 Variance of the Sum of Independent Random Variables . . . . . . . 390 6 12.4.7 Median . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 12.4.8 The Central Limit Theorem . . . . . . . . . . . . . . . . . . . . . . 391 12.4.9 Probability Distributions . . . . . . . . . . . . . . . . . . . . . . . . 391 12.4.10Bayes Rule and Estimators . . . . . . . . . . . . . . . . . . . . . . . 395 12.4.11Tail Bounds and Cherno inequalities . . . . . . . . . . . . . . . . . 397 12.5 Bounds on Tail Probability . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 12.6 Applications of the tail bound . . . . . . . . . . . . . . . . . . . . . . . . . 403 12.7 Eigenvalues and Eigenvectors . . . . . . . . . . . . . . . . . . . . . . . . . 405 12.7.1 Symmetric Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . 406 12.7.2 Relationship between SVD and Eigen Decomposition . . . . . . . . 408 12.7.3 Extremal Properties of Eigenvalues . . . . . . . . . . . . . . . . . . 409 12.7.4 Eigenvalues of the Sum of Two Symmetric Matrices . . . . . . . . . 411 12.7.5 Norms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 12.7.6 Important Norms and Their Properties . . . . . . . . . . . . . . . . 413 12.7.7 Linear Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 12.7.8 Distance between subspaces . . . . . . . . . . . . . . . . . . . . . . 417 12.8 Generating Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 12.8.1 Generating Functions for Sequences Dened by Recurrence Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 12.8.2 The Exponential Generating Function and the Moment Generating Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421 12.9 Miscellaneous . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 12.9.1 Lagrange multipliers . . . . . . . . . . . . . . . . . . . . . . . . . . 423 12.9.2 Finite Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423 12.9.3 Hash Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 12.9.4 Application of Mean Value Theorem . . . . . . . . . . . . . . . . . 424 12.9.5 Sperner's Lemma . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 12.9.6 Prufer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 12.10Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 Index 433

2017-09-26

空空如也

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

TA关注的人

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