Sunday, 18 September 2016

Reducible state space Markov chains

While reviewing a paper last night, I started thinking about reducible state space Markov chains.  Most undergraduate probability students are fed theorems about irreducible Markov chains.  To summarize these theorems.


  • If two states communicate, then they are either both recurrent or both transient.
  • If a MC is irreducible and all states are positive recurrent, then there exists a unique stationary distribution.
  • If a MC is irreducible, aperiodic, and has a stationary distribution, then it converges to that.

We can ask a set of questions about reducible Markov chains to test our intuition for the subject.
  • Let's setup a trivial 4 state Markov chain where the first two and last two states form separate communicating classes.
  • How many stationary distributions exist?
  • Do limiting distributions exist?
  • Does the limit distribution depend on the initial distribution?  How many possibilities are there?

Let's try to answer them.
  • There are an infinite number of stationary distributions.  If you take the stationary distribution of the first class and the stationary distribution of the second class, then any linear combination (equal to 1) of these two would be a stationary distribution would be a stat. distribution of the full 4-state Markov chain.
  • Limiting distributions do exist.  Let's think about the intuition here.  If the total prob. mass on the first two states is m_0 and the rest is 1-m_0, then starting from this initial distribution, each iteration of the chain would "stir" this vector but only stir within their respective classes.  So the first two states of this vector would converge to its limit distribution and same with the last two.  This means the overall limit distribution would be a mixture of the individual limit distributions weighted by the (m_0, 1-m_0) vector.

Wednesday, 19 December 2012

Course Catalog: Classical Composition

Description: This is a course on classical music composition that will teach the principles of melody, harmony, and orchestration.  However, this course does not teach you to form you musical ideas.  That comes from your talent.  If you don't have it, you can become an orchestrator.  The distinguished alumni of this course usually breaks with the principle we teach them and write great music nevertheless.  (Shostakovich, Debussy)

Course Credit: None

Pre-Requisites: No technical pre-requisite.  However, one should try to live a life of calamity, solitude, and mental instability through the achievement of at least one of the following:


  1. Unfulfilling / unrequited love for a string of women who are outside of your social class, for example members of the aristocracy or the royals.  See Beethoven.
  2. If you are homosexual, the unfortunate need to oppress your orientation due to social pressures of your society.  See Tchaikovsky.
  3. Have a high infant mortality rate.  See Bach.
  4. Losing of either vision or hearing.  (See Beethoven or Rodrigo)
  5. Live under a repressive Communist dictatorship (Shostakovich)
  6. Lastly, having your wife engaging in an affair with one of your best friend.  (Schumann)



Tuesday, 18 December 2012

AI-assisted political science

In the wake of the Sandy Hook shooting, there has been much debate on the radio about the gun policy in the United States.  The gun advocates stress that banning ownership of guns will not take it out the hands of criminals and decrease violent crime.  Both sides of the debate totes different statistics in order to support their own side.  During the presidential debates, there were numerous occasions where numbers were presented and its truthfulness contested by Obama and Romney.  One instance that comes to mind was when the factual accuracy of Romney's tax policy for the middle class was in dispute.

I think this is one area where information retrieval / data science /weak AI (doesn't mean crappy AI, but just to distinguish it from the well-defined Strong AI term) can really contribute to the public sphere.  Imagine a Google or Wolfram Alpha type program that parses the content of a debate and automatically checks for factual accuracy: gun crime rate, economic data, demographics, tax rates, tax codes etc, perhaps via an overlay on the screen.  This really would sway public discussions from "what are the facts" vs "what is the right policy".  It also prevents cheating and mis-representation of facts.

To push this idea further, imagine an AI-assisted data retrieval / analytics program for the common masses.  To take an example, I wanted to draw a simple correlation graph of gun ownership rates by country vs homicide rate by country.  Just to answer this one simple question, I had to manually enter / merge two separate tables found on Wikipedia, and then filter the data for missing entries using MATLAB, and perform a plot.  This set of computer skill, in the short future, is beyond the common knowledge of the average citizen, yet they need these types of questions answered concretely in order to vote on the right candidate / policy for this country.  How about a more advanced search  / analytics that would, given a question in natural language format, e.g. "Has the crime rate in NYC decreased after 1990?", it would automatically retrieve & clean the relevant data and perform the relevant statistical analysis.  (Regression, classification, etc.)  Currently Google / Bing can answer factual questions, but they are still one step away from answering analytical questions.

Sunday, 25 November 2012

Richard Dawkins on the evolutionary basis of morality

I was just watching a Richard Dawkins lecture at Randolph-Macon Women's College on YouTube.  He was asked a question about the basis of atheistic morality.  Dawkins proposed that our moral sense comes from the fact that our pre-historic ancestors lived mostly with next-of-kins hence 1) altruism will benefit the preservation of similar genes 2) there's a high probability of being in long-term contact with these individuals who can then reciprocate the good will.
I would propose that altruism serves to improve upon another evolutionary survival objective, the preservation of the species.  When pre-historic human beings lived in tribes, there was a high risk of destruction from other animals, diseases, and natural elements.  Hence at some point, competition to extinguish a rival member of the same species is out-weighed by the risk that the size of the species might fall below a critical threshold and threaten extinction.  For example, you don't want to kill Adam for stealing your girlfriend because he and you can work together when the tigers attack tomorrow night.
If we think about tribes and animal social organizations as entire units, then that unit would be evolving to maximize its survival as a whole.  If a society randomly generated a moral sense that does not include any altruism in an "attempt" to maximize individual benefits, that group as a whole (and consequently the individual) might have a lower probability of survival because the survival benefits that are derived from the group would be lost (i.e. strength in numbers).  In another words, when the survival of the individual is linked to a certain critical mass and critical health of his immediate social organization unit, this species would likely evolve some moral sense due to the pressure of natural selection even though this moral sense, on the surface, appears to be anti-beneficial to the individual upon a first-order examination.

Tuesday, 9 October 2012

Similarity between music performance and muay thai

I'm writing a somewhat satirical comparison between music performance (mainly violin) and muay thai.

  1. In violin, you practice boring etudes and scales in order to improve your fundamentals so you can better play your beautiful pieces.  In Muay Thai, you practice boring conditioning, mitt, and heavy bag drills in order to improve your athleticism and technique so you can better hold out in your fights.
  2. In violin, technique alone is not enough.  At a high enough level, there's a deep, almost unteachable, element of artistic creativity and musicianship that brings the techniques alive in a coherent work of musical art.  In Muay Thai, technique alone is not enough.  At the high level, you need a great sense of strategy, movement, and mental determination that is almost unteachable to bring all your techniques together in a work of martial art.
  3. In violin performance, you "practice-perform" your pieces by getting nervous and playing in a Masters class.  In Muay Thai, you "practice-fight" by sparring with partners.
  4. Before a violin performance, you become frigging nervous about messing up.  Before a Muay Thai bout, you become frigging nervous about losing and getting messed up.
  5. In a Muay Thai fight, if you mess up you might get embarrassed and/or knocked out.  In a music performance, if you mess up you might get embarrassed and/or knocked out.
  6. When you're too old to be a travelling musician, you become a teacher in a music school.  When you're too old to be fighting professionally, you become a coach in a gym.
  7. If you cannot make a living performing music, you can always teach the instrument.  If you cannot make a living fighting Muay Thai, you can always become a coach or personal trainer.

Saturday, 23 April 2011

Practical use for characteristic function & electrical engineering technique in evaluating sines

Yesterday I was thinking about the uniqueness of the heat equation in both the Cauchy setting and the Dirichlet boundary setting.  While thinking about this, the mathematics came down to computing the convolution of the heat kernel with the initial condition which is periodic with fundamental domain $[0,L]$.
After while, I needed to compute the convolution of the heat kernel with a sin function.  In probabilistic terms, I need to compute
$$ E[sin(X)] \; X \sim N(\mu, \sigma) $$
Brute forcing the expected value is very difficult. Then i realized that we can use the good old characteristic function if we represent $sin(X)$ as $\frac{e^{iX}-e^{-iX}}{2i}$
If we convolve a sine signal with some kernel, how do we know the output is still a sine signal?  Well if the kernel is symmetric (even), that means the Fourier transform will be even.  Since sine has a spectrum consisting of two Dirac delta functions at $+\omega$ and $-\omega$, then the output of the convolution will be another sine function of a different magnitude.

Saturday, 2 October 2010

Why a strong grasp of history is important for scientists

The purpose of the study of history is to learn from the past so we can make better decisions in the future. In a geeky machine learning analogy, it is kind of like processing more "training data" so that we can minimize our prediction error.  A scientist should have a pretty strong concept of the history of science including
1. The history of development in this sub-discipline.  In machine learning, that translates to early inception of the field in A.I., the problems with the A.I. (search space) technique, entrance of statistics (VC, generalization errors), parallel development in neural science, up till the present day.  With this, the researcher can better plan his strategy to maximize success in the long run.
2. Also the broader context of the development of scientific thoughts.  Scientific revolution, paradigm shifts in scientific progress.

Similarity between orchestra and basketball team

Last Tuesday I was playing basketball and then went quickly to my weekly university orchestra rehearsal.  As much as the two different crowds can be, there are some striking similarity between these two activities.

On an individual level, each player on a basketball team or in an orchestra must maintain individual technical proficiency.  The musician practices his/her instrument by spending hours on scales, etudes, and concert pieces to build better facility and musicianship.  The athlete spends hours on drills, to improve shooting,dribbling, defending, endurance.  Both require tremendous discipline and dedication.  On a side note, both also suffer from performance anxiety (like performing at Carnegie Hall or taking that fateful foul shot when you have 5 seconds left in the game)

There is also similarity in the team dynamics.  In an orchestra, each musician subjugates his/her individual interpretation of the piece and tries to blend with the whole group.  Each musician is also given different parts thus different roles.  It can be the solo melody, simmering background accompaniment, or a grand tutti.  The violinist must pass off the beautiful theme to the woodwinds and play pianissimo trills so that the entire orchestra can make music together.  The basketball player need to pass the ball selflessly and sacrifice your own personal glory for team victory.

On a last note, there is the coach/conductor.  Their job is to make sure mend personalities (musicians can have sometimes bigger egos than basketball players) and dictate the team strategy / musical interpretation.

How can PhD in engineering help in music performance?

In the fourth year of my PhD now and just writing a blog piece about some of my changing habits in violin playing/practicing after grueling through some serious academic research.
PhD students are trained to research. To find interesting solvable problems in existing knowledge, explore and make some advances. The whole process is very amorphous and self-directed. First, a large amount of time is spent finding a good problem. This is very fortuitous and often happens at a "Eureka" moment. Over time, the PhD student develops the ability to seek out interesting problems that are solvable. This is similar to a musician picking a piece that interests him/her and is within the reach of his/her technical ability.
After finding a problem, you are required to analyze it into smaller projects that can be tackled.  It also involves a certain about "diagnostics" in the implementation phase, to figure out what stage of your solution has broken down.  A violinist must also analyze his/her target piece.  Usually there would be two phases, a technical analysis and a musical analysis.  In the technical analysis, one must discover trouble spots and usually design efficient and clever "mini-etudes(studies)" to overcome such difficulty.  These difficulties can include

  1. Left-hand: lack of finger pressure, side of fingers touching nearby strings, lack of finger dexterity (especially on the fourth finger), dreaded intonation (especially on double stops), getting a nice wide vibrato (difficult on double stops)
  2. Right-hand: awkward string crossing, spiccato, upbow staccato, fast whole bow strokes.  Overly noticeable bow changes.
After technical analysis, the musician has to think about phrasing, composition background, balance, dynamics etc.

On the whole, my playing is more rigorous and I have gotten better at figuring out how to practice for a difficult piece.  (Waxmen Carmen fantasy and Devil's Trill right now)