個人檔案王益的空间 Wang Yi's MSN Spac...相片部落格清單更多 工具 說明
29 December

Stochastic Sampling

The basic goal of stochastic sampling is to draw random samples from a given distribution p(x). Sometimes, p(x) is not exactly known, for example, knowing only f(x)=p(x)/K.

Given the ability of stochastic sampling, we may do the following things: (i) approximate p(x), (ii) integrate p(x), and (iii) optimize p(x).

A difficulty for stochastic sampling is that the form of p(x) or f(x) is usually complex, however, we can only sample directly from some easy-formed distributions, like discrete distribution, uniform distribution or unit Gaussian. So, usually we sample from an easy-to-sample distribution q(x) instead of from p(x) or f(x), then we either assign each sample point a "weight", or an "acceptance probability" which decides whether we accept this point as a sample from p(x) or f(x).

Some basic sampling methods include:
  • Monte Carlo: Sample from q(x). No weight or acceptance probability is calculated. Just pretends that samples from q(x) is from p(x), and use the samples to compute the integration of p(x).
  • Weighted Sampling: Sample from q(x). Assign each sample x a weight w=p(x)/q(x). Use the weighted samples to compute the integration of p(x).
  • Rejection Sampling: Sample from q(x), where q(x) > p(x) in the whole domain of p(x). Accept each sample x by an acceptance probability a=p(x)/q(x).
In above methods, we have to choose q(x) which is easy-to-sample and approximate p(x). These two requirements are often contradictory. In order not to be bothered by choosing q(x), we may resort to Markov Chain Monte Carlo methods, which constructively approach p(x) without q(x) along a Markov chain.
  • Metropolis Sampling: Sample xt from a transition proposal q(xt|xt-1). Accept the sample by the probability
    \alpha = min\left[ \frac{f(x_t)}{f(x_{t-1})}, 1 \right]
    The intuition is to accept xt with high probability if f(xt) > f(xt-1). This requires that q(a|b)=q(b|a).
  • Metropolis-Hasting Sampling: Change the acceptance probability to
    \alpha = min\left[ \frac{f(x_t)q(x_t|x_{t-1})}{f(x_{t-1})q(x_{t-1}|x_t)}, 1 \right]
    This trick removes the requirement of q(a|b)=q(b|a).
  • Gibbs Sampling: In case that f(x) is very high-dimensional, it is expansive to compute f(x). So we avoid computing acceptance probability by assuming a=1, which means always accept the sample.
  • Simulated Annealing: Change the acceptance probability to
    \alpha = min\left[ \left(\frac{f(x_t)}{f(x_{t-1})}\right)^{1/T(t)}, 1 \right]
    where T(t) decreases from a large value to 1. The intuition is that initially, a large T increases the probability to accept an xt which does not increase the value of f(xt).
Few more words for simulated annealing: to take it as a sampling method, we decrease T down to 1; to make it an optimization method, we decrease T down to 0.

References:
  1. B. Walsh. Markov Chain Monte Carlo and Gibbs Sampling. Lecture notes. 2004.
  2. David J.C. MacKay. Information Theory, Inference, and Learning Algorithms. Chapter 29 and Chapter 30.


15 December

梅孟八卦

最近一部电影《梅兰芳》炒得火热。由此得知原来梅兰芳曾经和孟小冬曾有一段情愿。意外的在一篇博客上看到梅孟二人的一张合影(http://blog.sina.com.cn/s/blog_470ffe5b0100bmcu.html?tj=1),真是才子佳人,令人称羡。不知何故,孟最后嫁给了杜月笙(此篇博文中亦有杜之照片——不知当作何评价),将青春奉献于照顾一个垂垂老矣并妻妾成群的大亨,并终老于在台北孤寂的晚年。

人生就是如此难以把握。往往当幸福即将来临的时候,一个突如其来的大浪就将计划打破。人生八九不如意。古往今来,男女老幼,权贵贫民都难逃过。区别在于,狠一点的人在大浪中努力的游着,自去体会其中的酸甜苦辣;不那么狠的中途放弃,也就归于沉寂了。
8 December

挑对象和淘地摊

俗话说“男怕入错行,女怕嫁错郎”——男人靠工作养家,工作当然重要;女孩嫁人都自主或不自主的需要更多顾及家庭,生活保障就交给“郎”了,所以选择郎君是很重要地!

看看我认识的女孩们,在选择问题上表现总体来说相当谨慎。开个玩笑,用地摊淘宝打个比方,似乎可以有如下几类:
  • 摊上货好,女孩也会挑(明白自己要什么),包包充裕,一拍成交。即使后来发现买的东西有不尽如人意的地方,因为早在意料之内,所以可能很自如的处理。
  • 摊上货物琳琅满目,女孩钱包也还充裕,可是不知道要的是什么,犹犹豫豫中货币已经贬值,但却没有注意到,还沉浸在挑选的购物快感中。
  • 摊上货物琳琅满目,女孩钱包充裕,没有在贬值,也大概知道要的是什么,但是不主动和摊主交流,了解货物特点后下决心。将有面临货币贬值的危险。
  • 摊上货物不错,女孩钱包不充裕,但是热心肠愿意给同伴出出主意。这种其实是很受大家尊重和信任的。
哈哈。说来惭愧。可能是受清华一贯的“是个男人他就帅”的封建思想毒害太深,我觉得自己看到的摊上货物琳琅满目还都不错。不管怎样,绝对不敢无调侃美女挑对象这一古今中外之人生大事。

我对职业发展方向的忧思

最近对职业发展想的比较多。以来考虑家庭安顿的问题,而来也要考虑我们国家发展趋势的问题。

从家庭的角度考虑,作为独子,不得不考虑父母的因素。父母亲在西方国家不能享受当地的医疗保障,这是个大问题。一个朋友的姐姐,在美国有家庭和工作,把她的母亲接到美国生活。可是老人家没有医保,虽说目前身体还不错,可是如果真的生病,看来还得飞跃重洋回到国内来医治。另一个朋友,曾近在法国学习和生活了多年,她提到有一次偶染小恙,痛苦难忍,可是法国的医生愣是没法给治疗,最后飞回家,涂了点碘酒,第二天就好了。

另一个和父母相关的问题是,老人家在西方国家生活不便,也很难建立朋友圈。这一点我想在美国应该比在欧洲好点。毕竟旧金山这样的地方,华人那是充盈着的。听说澳大利亚的悉尼也是华人很多的。

另一个因素就是国内稳定的考虑了。记得从我上大学开始,我就很担心我们的国家的稳定。现在尤为担心。这些年里,大家讨论最多的两个问题就是(1)粮食价格是否放开;(2)土地所有权是否放开。从最近的十七大的报告看来,这两个让农民致富的根本问题仍然没有解决。我小时候,也就是改革开放的头十年,新闻里经常报道“万元户”——农民致富的先锋。可是到90年代,这种农民致富的报道越来越少了。随着城市化和工业化进程的加剧,大批农地被征用——实际上就是剥夺了农民赖以生存的土地。形形色色的补助根本不能帮助农民建立新生活。失去土地的农民成为城市边缘人口,比如北京的的哥。或者不得不进城打工,维持着艰辛而贫困的生活。

在那些距离城市较远的乡村,在农业税和控制粮价的压力下,发现自己辛苦劳动不能致富,不辛苦劳动还要罚款(上税)——换句话说:辛苦并贫穷着——和那些失去土地的农民一样。一个同事的母亲生病住院,请了一个甘肃护工,每餐吃一个馒头,菜就是剪断的白菜叶子,用医院的锅炉热水泡着烫熟,加点盐。她说她家在当地就算生活水平中上了。

我的祖国是个号称十亿人民九亿农的国家。改革开放三十年后的今天,种粮的没钱赚,甚至还有农民土地被征,无法种粮。而从最近的十七大又看不出政府有什么高招儿。这让我很难过。随便翻翻历史,土地兼并和压制粮价是中国历史上导致农民贫困和王朝更迭的最常见和最根本的原因了。

我和一位“京官”说到我的担忧。她说中国经济发展了三十年了,底子大。可是当年的古巴和伊朗,也都是国内国外资本争艳形成了巨大的繁荣。可是这种经济发展导致贫富差距悬殊,最后一场动乱,一切都成云烟。