Random thoughts about politics I

I got cornered at a lunch conversation with some friends on issues related to North Korea. While a communist-ideology sympathizer at heart, I argued that North Korea isn’t as bad as western media has portrayed. But Daniel pointed out acrimoniously that NK lacks freedom of press etc, that makes it a completely loser to other major powers in the world stage today. So this is my attempt to regain some confidence in my original belief that an alternative political system to the western one is possible and potentially better.

  1. the 4 year election cycle in the US makes the leaders highly volatile, and coupled with the bicameral legislative system, it has suffered severe credibility crisis in recent decades. This resulted in a series of catastrophic foreign policy deals, including the failure to bring NK to the nuclear deal table.
  2. NK’s grain output per capita is higher than India; similar the life expectancy is slightly higher, despite the fact that the latter has been a “true” democracy for decades, and the western powers have sought to starve off NK for decades through many rounds of sanctions.
  3. Given all the precedence of states bombarded and annihilated by the US, including Libya, Iraq, and soon to be Syria, there is no reason for a sovereign state like NK not to resist at all cost and build up its own nuclear arsenal. US’s goal is simply to spread the ideal of democracy all over the world, similar to how Christians tried to spread their gospel around the world, in the form of crusade when necessary. Over time the abstract ideology becomes more institutionalized and outstrips the importance of its original motivation of helping humanity. In short, a bug in code is often worse than no code at all.
  4. The idea of nuclear containment is itself a highly unfair proposition. Why should smaller countries be banned from building an arsenal just like the big ones? Of course one could argue the fewer players have the technology, the less likely we will see armageddon, and indeed if I were a leader of a big country I would argue the same. But from the small players’ perspective, it’s completely unfair. Also if a country like Pakistan could own nuclear capacity simply because it’s a democracy, why shouldn’t a country with a better peace record and surveillance not be allowed to, simply because its founding ideology isn’t aligned with the major power?
  5. It is conceited to suggest that an ideology embraced by a whole nation is of no virtue at all, compared to the prevailing political system of the day. True, pure communism may not work in practice, but neither does true capitalism. The real world consists of a mixture of the two extreme visions, where capable workers are sufficiently motivated, and overall population is guaranteed an above-subsistence level of living. Communism has served as a check for workers’ rights during the cold war era, and income inequality has since skyrocketed after the collapse of the Berlin wall. At the same time, the prosperity of capitalist societies has motivated communist nation states to adapt themselves to improve living standards of their people. The greed of capitalists will go unchecked without some form of menace from the grass-root working class. This has been pointed out in the greater leveler book by Scheidel. Without western sanctions and embargoes, it’s very hard to predict what the welfare state of former and current communist states would have been.
  6. North Korea’s major disasters occurred during the 1990’s under the rule of Kim Jong-Il, who was a stuttering incapable ruler. The new leader appears much more capable and has no reason not to care about the welfare of his own population, even for the selfish reason (as all leaders would) of self-preservation of power. He is certainly a high stake gambler, but to do anything less would signal weakness to the outside powers like US who is seeking every convenient opportunity to dismantle the regime in the name of democratic freedom, much like how a well-meaning doctor wants to destroy the cancer cell, forgetting the true objective should be to save the patient. Given US’s track record in the middle east, no sane person would believe it can do anything better than status quo through its brute force intervention.

To be continued after I read more on the subject..

Advertisements
Posted in Uncategorized | Leave a comment

A typo in a book that cost me a day

I have been insatiably reading the computational complexity book by Sanjeev Arora and Boaz Barak, which from the table of contents and review from big guns like Avi Wigderson, Mike Sisper, seems like the holy bible and culmination of all complexity research over the past 3 decades, despite being called a beginning graduate textbook. Eventually I decided to skip ahead to chapter 19 on error correcting code and hardness amplification, but got seriously stumbled by the description of Berlekamp-Welch algoithm (a name I cannot remember without the mnemonic resemblance to “Berkeley campus”). It turns out the author wrote 2d and d instead of 2d + d/2 and d + d/2 for the degrees of the univariate polynomials in the bivariate graph interpolating polynomials; I have been scratching my head trying to understand how one could solve a linear system of 4d equations with 3d + 2 unknowns. But thanks to this wonderful lecture notes by MIT , I was able to reconstruct the correct parameters. Another thing I wish the book had was in-line reference to papers/books where the proofs/algorithms were taken from, but I understand that’s a pretty time-consuming task as well.

Posted in Uncategorized | Leave a comment

Buggy day

Being a software engineer means that it’s a constant struggle between depression and complacence. At the peak of either extremes, there is also the need for periodic introspection. Hands-on people, as are typical of engineers, tend to be negligent of more nurturing and routine things in life. These things are not as rewarding or exciting, but can make a difference in shaping us as human beings, how we perceive ourselves, how we want to chart the course of life, and our influence on people all around. One excuse we often give ourselves is that there is no time. Indeed, as a working class member, I have to take kids to school, do all the usual chores, as well as stay in office from 9 to 5, in addition to 1.5 hours on the road. But if we do not spend some quality time daily to nurture our soul, we run into the risk of leading a completely meaningless life, devoid of substance and purpose, and not only is this leading to a sad terminal state, but may also interfere traumatically as we drag our bodies towards that end state.

As we age, the amount of competitive pressure around us naturally rises. Also on the rise is the sense that our experience has enabled us to stay ahead of the game indefinitely. Even in my early 30s, I can feel that I am gravitating towards the same mental trap that millions ahead of me have experienced, the notion that a superpower, in the form of automated intelligence at my fingertip,  has dawned upon me that makes me invincible for life. Quite the contrary, this infatuation with and over-romanticizing of superpower is the death knell of the biological and sympathetic side of a person. The ease with which the said superpower is acquired should be caution enough against over-reliance on it. Unfortunately people often find the easy ways in life and follow their so-called passion without considering the context. The obvious thing to do is not always the right thing to do. The context is also very important. During the medieval age, a scribe is a very respectable job that has the status of a professor in today’s day and age, while nowadays a typist cannot even make a living, because virtually everyone is capable of that kind of skill. What truly distinguishes a person is some unique skill rarely seen in the mass. Unfortunately, the sheer multiplicative quantity of human beings has rendered such redeeming anomalies less and less likely over time, especially under the wave of globalization. So we often dial back to a second order competitive advantage, fostering a good habit by being persistent about it. This is a necessity, but alone does not lead to the age-old pursuit of life-long happiness. After all humans are conditioned to appreciate change (hopefully in the positive direction) in fortune, rather than an eternal possession thereof.

Habit that takes the form of robotic and thoughtless actions tends to degrade us as humans and contribute little to our characters. It merely enslaves our mind and numbs our sense of righteousness and ability to articulate. Habit that involves creative, presentational, and perhaps even mildly confrontational episodes tends to provide more utility as we chart through the difficult course of inter-personal relational quagmire at work, at home, and in the society at large. A scientifically trivial act of diary writing, for instance, juggles our mind in a spontaneous direction, with the collision of diction and emotion freeing us from the confine of algorithmic precision, a constraint imposed by our silicon nemesis to accelerate the process of intellectual polarization and squeeze the last breath out of an osmotic soul. Thus human life must be variegated, unanticipated, serendipitous, and original. To follow any predestined path is to defy the will of the Creator, which leads to misery by definition.

 

Posted in Uncategorized | Leave a comment

On Norbert Blum’s latest proof that P != NP

I first read about this on hacker news, which I encourage more people to subscribe for quality content in the tech/science space. Many people have raised doubts (including Scott Aaronson whose Democritus blog I used to follow) about the validity of the proof, but few seem to be able to point out any flaw to date. I found it generally well-written in the beginning, except some of the preliminary results seem too basic, such as the conversion between CNF and DNF, such as Lemma 1 and Lemma 2. The writing style reminds me of my REU project during summer 2007, when I wrote my first original research papers: the balance between non-triviality and clarity is often a newbie’s struggle.

In any case, I was happy with most of the arguments until the proof of Theorem 2. I am not questioning the correctness of its statement since I haven’t had time to try to find a counterexample or come up with a proof independently. The assertion, “By construction, no variable can be removed from c_\ell without destroying this property”, however, does seem wrong to me. Here is a simple counterexample:

Take p_1 = x_1 x_2 x_5, p_2 = x_2 x_3, m = x_1 x_4, and c_\ell = x_2 + x_5, where implicit product means and (\wedge) and + sign means or (\vee). Furthermore let f = p_1 + p2 and res_\beta(g_0) = f + m. Then c_\ell is clearly an f-clause but not a prime one, since x_2 alone is an f-clause.

Now I am not sure if this step is critical to the rest of the proof of Theorem 2, but I am suitably discouraged at this point to put in more salvaging time. This also highlights another complaint of mine, which is the unnecessarily complicated notation res_\beta(g_0), which I feel can be replaced by something more standard and light-handed.

Posted in Uncategorized | Leave a comment

A caffeinated adventure into optimization algorithms and numerical solver libraries in python

Motivated by some optimization problem in quantitative finance as well as simple curiosity, I started looking into some word-of-mouth ML related algorithms and various useful libraries to solve large scale constrained optimization problem. Perhaps my understanding of optimization has deepened over the years, and the newly bought green matcha tea bag has wrought wonder to my head, the documentation in the open source community with regard to the various numerical libraries seemed exceedingly clear. Here I will simply share a lightly annotated laundry list of all the useful tidbits picked up in 2 hours of distracted self-study:

  1. Bayes point algorithm: I first heard about this through a colleague’s work, where the main selling point seems to be the ability to control the model directly through the example weight, rather than feature weight. The definite reference seems to be this 34 page paper, which is clear on a sober afternoon, but can be quite daunting if one simply wants to scan through it to pick up the main idea. I haven’t finished it, but the first 5 pages look quite sensible and promise good return on time spent. My current speculative understanding is that this is a mixture of ideas from support vector machines, which focus on frequentist style optimization problem, and Bayesian inference, which is more expensive but has the nice “anytime” property, meaning even a non-converged model is useful. One thing I found funny was that the authors talked about Cox’s theorem on objective probability; not sure if it is really necessary in a technical paper like this, but authors are certainly allowed to digress a little philosophically.
  2. Bayesian linear regression: I learned this mainly through the namesake wikipedia article. Don’t look at the multivariate version, since it distracts you from the main point. The idea is to have a prior of some distribution for the weights (i.e., linear regressors), which can be conveniently chosen to be Gaussian (a conjugate prior). Then the posterior will have some Gaussian distribution whose mean and variance depend on the data as well as the prior. The formula presented towards the end indeed shows that if the prior is highly concentrated near its mean (high confidence), then the posterior distribution will lean towards the prior mean.
  3. Gauss Newton method: I thought I knew Newton’s method since grade school. Turns out even a veteran like me can get abysmally confused about the distinction between solving an equation and optimizing an objective function. So I spent a few minutes wondering why Newton’s method is considered a second order method, though to be fair, the label of second order has nothing to do with the use of 2nd derivatives, but mainly with the quadratic convergence rate. To those equally uninitiated readers, to a (vector-valued) equation of the form F(x) = y will typically have isolated solutions only when x and y are of the same dimension (assumed both to be in some Euclidean space). Otherwise you get a sub-variety as your solution, which numerical analysts and engineers typically don’t care for. Similarly optimization only makes sense when the objective function is real-valued, rather than vector-valued. By taking the gradient, one converts the later type of problem to the former. In any rate, I started looking up Gauss Newton, which isn’t exactly Newton Ralphson, after seeing this line in the implementation note of the trf library, which by the way, is extremely well written and makes me understand trust region reflective algorithm in one sitting. In it, the author mentions that one can approximate the Hessian matrix of a nonlinear objective function with J^T J. This looked vaguely similar to the typical linear regression exact solution, and in fact is related. As long as the objective function is a sum of squares of individual components, the GN algorithm works, but approximating Hessian with first order derivatives. This obviously can speed up things a lot.
  4. fmin_slsqp function in scipy: I found out about this mainly through this blog post. Upon looking at the implementation on github, I got a bit dismayed since a heavy portion of the code is done using python while and for loops. But I keep telling myself not to prematurely optimize, so maybe this will be my first library of choice. The underlying Sequential Least SQuares Programming approach looks somewhat quadratic.
  5. least_squares implementation in scipy: This one looks more promising in terms of performance, in particular it uses the trf library mentioned below, which promises to be appropriate for large scale problems.
  6. trust region reflective algorithm in scipy: the implementation note for trf above is quite good. The essential idea seems to be to treat a constrained optimization problem locally as a quadratic programming problem and bake the inequality constraints into the objective. Then reshape the region of optimization by the inverse of the diagonal matrix consisting of the distance to the boundaries in each direction (presumably the region is always convex so that this makes sense).
  7. Cauchy point: the solution of the gradient descent multiplier to maximize descent under the constraint that the independent variable doesn’t move beyond a certain radius. This seems related to Wolfe condition, but the latter guarantees convergence of gradient norm to  0, whereas Cauchy is just a way to cheaply optimize a single gradient descent step under constraint.
Posted in Uncategorized | Leave a comment

第一次认真做菜

第一次从厨神到厨霸转型。说笑了。一直觉得生活中唯一过不去的坎就是做饭问题。目前有个非常能干的阿姨代劳,但不能一辈子这样下去呀。所以今天在阿姨的指导下开始向专业级别挑战。前两天也看了写关于厨艺入门方面的知乎文章,详见学做菜如何入门。其中人气第一的回答很多技术细节令我有醍醐灌顶,见之恨晚之感。文中推荐以青椒炒肉丝作为入门菜,因为荤素搭配在火候和刀功方面都有挑战。所以今天我也尝试了一把。

可惜阿姨实在太能干,把青椒事先给我切好了,所以也已成功一半了。外加还给我准备了豆腐干丝。接下来我只要管切肉。平时我对切肉也相当没有技巧。最后往往切成肉丁和肉块并存。主要原因是常温下肉太软,加之到不够快,所以很难切出好的形状。这次多亏阿姨事先给我拿出冷冻的肉,就可以像锯木头一样工整地切。下锅之前,还要把肉放在碗里用稍许料酒,白胡椒,生抽,以及足量的生粉。中餐中生粉的重要性跟油差不多。没了它肉绝对炒不嫩。白胡椒是第一次听说,但是肯定不会难吃。

根据知乎上文,肉炒的时候要热锅冷油。而且建议油放到1/4锅的容量。这有点夸张。所以我只是比平时多加了点油,按照我的健康标准已经过多了。可惜今天锅是热了,油却预热时间过长。结果肉一下锅就劈哩叭啦,没有做到知乎文中的不吸油的状态。不过油放的足够多,最后捞上来也能继续炒别的。文中还说一上来不要去搅肉,但因为我油放的浅了,根本盖不住肉,所以不得不很早就开始搅,当然也是比较轻微的。可惜很晚才意识到可以把大火调到最小,所以有几根肉丝炒的比较煳。最后阿姨过来直接命令出锅,即便有几根肉丝还微带血丝。

把肉直乘到最终装菜的盘子里。花了一点时间把肉和剩下的油分离。接下来炒豆干和肉丝就比较容易了。具体是将锅里剩下的油烧热,然后先将豆干丝倒下去翻炒,然后过大概20秒再放青椒丝。不久之后再放一勺盐,和稍许红糖。后者是为了提高鲜味,因为家里不用耗油等吃了会口干的调料。最后还有一个关键步骤就是尝咸淡。之前放盐总觉得一小勺太多。这次看了知乎文章才知道都是半勺半勺加的,所以直接放了一勺。看来咸淡正合适。

这是炒完了的样子:

20170709_183442.jpg

这是开吃半分钟以后的样子:

20170709_185210.jpg

Posted in Uncategorized | Leave a comment

How do I pronounce my name?

Today as usual I arrived late to company breakfast, due to morning busy work with kids. As soon as I finished ordering, the receptionist asked for my name. So with some nasal stuffiness, I said John. After several repetition, he finally wrote down “Jong”. I had no idea how he came up with this highly unusual spelling. Maybe it is somewhat common among Koreans? Maybe he himself is also Korean? I then corrected his spelling. Just like other receptionists before him, he eventually figured it out and re-uttered my name with a theatrically condescending tone. Outraged by my inability to get it right the first time, I retorted: “how should I pronounce my name?” He then smiled and conceded that he had bad hearing. But surely there is something wrong with the way I handled the nasality of the word “John”. It’s one of those American words that has no dictionary perfect pitch.

My voice tends to lack the resounding quality of a leader, or even a domain expert. I attribute this not to my physical inadequacy, but a general lack of confidence. When I utter a sentence, it usually has not been completely thought out. Even if it has, my mind can vacillate mid-air. Throughout my higher education I have over-emphasized depth and originality of ideas and neglected presentation. It takes considerable deliberation to present a piece of information in a socially convincing manner, no matter how trivial it is. Indeed, great speakers tend to over-sell mundane ideas, over and over, without boring or embarrassing the audience. I might have missed a critical lesson for not going through the brutality of academic job search, which requires an inordinate amount of salesmanship. So as a stage II corporate parasite, I must voluntarily allocate quality time to re-establish my character independence.

Posted in Uncategorized | Leave a comment