Archive

Archive for the ‘Notes’ Category

Two basic probabilistic proofs[zz]

Repost from http://djalil.chafai.net/blog/2011/08/23/two-basic-probabilistic-proofs/

Very elegant proof!!

Johan Jensen (mathematician)

I enjoy basic beautiful mathematical proofs. I see them like small jewels, that I collect from time to time. In this spirit, this post proposes probabilistic proofs of a couple of basic results.

Jensen inequality. The Jensen inequality states that if X is an integrable random variable on Rn and φ:Rn→R a convex function such that φ(X) is integrable, then

 

φ(E(X))≤E(φ(X)).

 

To prove it, we start by using the convexity of φ, which gives, for every integer n≥1 and every sequence x1,…,xn in Rn,

 

φ(x1+⋯+xnn)≤φ(x1)+⋯+φ(xn)n.

 

Now, we use the integrability of X and φ(X): we take x1,x2,… random independent and distributed as X, we use the strong law of large numbers for both sides, the fact that φ is continuous for the left hand side, and the fact that if P(A)=P(B)=1 then A∩B≠∅. I also appreciate the proof based on the equality for affine functions, the variational expression of a convex function as the envelope of its tangent hyperplanes, together with the fact that the supremum of expectations is less than or equal to the expectation of the supremum. Read more…

Categories: New Tech

Instructions for Installing RPM Files Using Alien [zz]

Repost from Ubuntu Blog.

Installing Alien

You can install alien itself from the Ubuntu Universe repository by adding the repository to your list of sources and doing:

$sudo apt-get update
$sudo apt-get install alien

Installing the .rpm file

To install the .rpm file, you first need to convert it to a .deb file which can be installed on Ubuntu.
I assume that you downloaded the package to your Desktop (~/Desktop is the directory)
You can convert the .rpm to a .deb by using the following commands.
$cd ~/Desktop
-This will change the directory to your desktop, where you have the .rpm file.

$sudo alien -k name-of-rpm-file.rpm
– This will convert the .rpm to a .deb.
– The “-k” will keep the version number. Otherwise alien adds a “1″ to the version number.
– Tip: Use Smart Tab Completion to avoid mistyping the file names :)

$sudo dpkg -i name-of-deb-file.deb
– This will install the .deb package

Try reading the alien manpage for more details on how to convert other kinds of packages and the options available.

Categories: Ubuntu

Efficient Annotator

Do  you know Boris Babenko? If not, you must know Serge Belongie, who is Boris’s PhD advisor! If not either, look at the GIF figure below, you must recognize him if you are familiar with face recognition!

Then look at the following video, it’s amazing to have such an efficient human-computer interactive annotator. Boris, together with his colleagues, found a company to make it come true, it’s now in the progress!

http://anchovi.com/

http://blog.anchovi.com/

Categories: CV gossip, Gallery

std::min and std::max [zz]

This is a repost from blog of Heifner

Today I typed the following:

int t = (std::max)(timeout, lagtime);


Why did I put parentheses around std::max? Because windows.h defines (among other things) a max and a min macro. If you include windows.h the above code will not compile. For example the following:

#include "windows.h"
#include <algorithm>

void foo() {
    int i = 5;
    int j = 7;
    int x = std::max(i,j);
}


Will produce the following error with Visual Studio C++ 2005:

1>test.cpp(7) : error C2589: '(' : illegal token on right side of '::'
1>test.cpp(7) : error C2143: syntax error : missing ';' before '::'


There are a number of ways to work around windows.h defining these two macros.  Read more…

Categories: C++

Matlab GUI的数据传递方式总结[zz]

matlab gui共有六种参数传递方式和范围各不相同

        1。运用gui本身的varain{}、varaout{}传递参数(注:这种方式仅适用与gui间传递数据,且只适合与主子结构,及从主gui调用子gui,然后关掉子gui,而不适合递进结构,即一步一步实现的方式)

              输入参数传递:
比如子GUI的名称为subGUI, 设想的参数输入输出为:[out1, out2] = subGUI(in1, in2)
在subGUI的m文件中(由GUIDE自动产生):
1.第一行的形式为:function varargout = subGUI(varargin)
该行不用做任何修改;varargin 和 varargout 分别是一个可变长度的cell数组(MATLAB帮助文件中有说明)。输入参数in1和in2保存在varargin中,输出参数out1,out2包含在varargout中;
2.在subGUI的OpeningFcn中,读入参数,并用guidata保存,即:
handles.in1 = varargin{1};
handles.in2 = varargin{2};
guidata(hObject, handles);
返回参数的设置:
1. 在GUI子程序的OpeningFcn函数的结尾加上uiwait(handles.figure1); figure1是subGUI的Tag;
2. subGUI中控制程序结束(如”OK”和”Cancel”按钮)的callback末尾加上uiresume(handles.figure1),不要将delete命令放在这些callback中;
3. 在子GUI的OutputFcn中设置要传递出去的参数,如 varargout{1} = handles.out1;varargout{2} = handles.out2;末尾添加 delete(handles.figure1); 结束程序。
在GUI的OpenFcn中,如果不加uiwait, 程序会直接运行到下面,执行OutputFcn。也就是说程序一运行,返回值就确定了,再在其它部分对handles.output作更改也没有效果了。
加上uiwait后,只有执行了uiresume后,才会继续执行到OutputFcn,在此之前用户有充分的时间设置返回值。
通过以上设置以后,就可以通过 [out1, out2] = subGUI(in1, in2) 的形式调用该子程序。
在一个GUI中调用另一个GUI时,主GUI不需要特别的设置,同调用普通的函数一样。在打开子GUI界面的同时,主程序还可以响应其它的控件。不需要担心子GUI的返回值被传错了地方。
Read more…

Categories: Matlab Tags: , ,

统计学习那些事[zz]

统计学习那些事

香港科技大学 电子与计算机工程系 eeyangc@gmail.com

在港科大拿到PhD,做的是Bioinformatics方面的东西。Bioinformatics这个领域很乱,从业者水平参差不齐,但随着相关技术(比如Microarray, Genotyping)的进步,这个领域一直风风光光。因为我本科是学计算机电子技术方面的,对这些技术本身并没有多大的兴趣,支持我一路走过来的一个重要原因是我感受到统计学习(Statistical learning)的魅力。正如本科时代看过的一本网络小说《悟空传》所写的:“你不觉得天边的晚霞很美吗?只有看着她,我才能坚持向西走。”

离校前闲来无事,觉得应该把自己的一些感受写下来,和更多的爱好者分享。

先介绍一下我是如何发现这个领域的。我本科学自动化,大四时接触到一点智能控制的东西,比如模糊系统,神经网络。研究生阶段除了做点小硬件和小软件,主要的时间花在研究模糊系统上。一个偶然的机会,发现了王立新老师的《模糊系统与模糊控制教材》。我至今依然认为这是有关模糊系统的最好的书,逻辑性非常强。它解答了我当年的很多困惑,然而真正令我心潮澎湃的是这本书的序言,读起来有一种“飞”的感觉。后来我终于有机会来到港科大,成为立新老师的PhD学生,时长一年半(因为立新老师离开港科大投身产业界了)。立新老师对我的指导很少,总结起来可能就一句话:“你应该去看一下Breiman 和Friedman的文章。”立新老师在我心目中的位置是高高在上的,于是我就忠实地执行了他的话。那一年半的时间里,我几乎把他们的文章看了好几遍。开始不怎么懂,后来才慢慢懂了,甚至有些痴迷。于是,我把与他们经常合作的一些学者的大部分文章也拿来看了,当时很傻很天真,就是瞎看,后来才知道他们的鼎鼎大名,Hastie, Tibshirani, Efron等。文章看得差不多了,就反复看他们的那本书“The Elements of Statistical learning”(以下简称ESL)。说实话,不容易看明白,也没有人指导,我只好把文章和书一起反复看,就这样来来回回折腾。比如为看懂Efron的“Least angle regression”,我一个人前前后后折腾了一年时间(个人资质太差)。当时国内还有人翻译了这本书(2006年),把名字翻译为“统计学习基础”。我的神啦,这也叫“基础”!还要不要人学啊!难道绝世武功真的要练三五十年?其实正确的翻译应该叫“精要”。在我看来,这本书所记载的是绝世武功的要义,强调的是整体的理解,联系和把握,绝世武功的细节在他们的文章里。

由于篇幅有限,我就以Lasso和Boosting为主线讲讲自己的体会。故事还得从90年代说起。我觉得90年代是这个领域发展的一个黄金年代,因为两种绝世武功都在这个时候横空出世,他们是SVM和Boosted Trees。

Read more…

Stanford-CV华人教授李飞飞写给她学生的一封信[zz]

2011-06-26 4 comments

De-mystifying Good Research and Good Papers

By Fei-Fei Li, 2009.03.01

Please remember this:

1000+ computer vision papers get published every year!

Only 5-10 are worth reading and remembering!

Since many of you are writing your papers now, I thought that I’d share these thoughts with you. I probably have said all these at various points during our group and individual meetings. But as I continue my AC reviews these days (that’s 70 papers and 200+ reviews — between me and my AC partner), these following points just keep coming up. Not enough people conduct first class research. And not enough people write good papers.

– Every research project and every paper should be conducted and written with one singular purpose: *to genuinely advance the field of computer vision*. So when you conceptualize and carry out your work, you need to be constantly asking yourself this question in the most critical way you could – “Would my work define or reshape xxx (problem, field, technique) in the future?” This means publishing papers is NOT about “this has not been published or written before, let me do it”, nor is it about “let me find an arcane little problem that can get me an easy poster”. It’s about “if I do this, I could offer a better solution to this important problem,” or “if I do this, I could add a genuinely new and important piece of knowledge to the field.” You should always conduct research with the goal that it could be directly used by many people (or industry). In other words, your research topic should have many ‘customers’, and your solution would be the one they want to use. Read more…