Thursday, March 15, 2012

March 15, 2012

I have said this before, but my comment bears repetition in light of today's cartoons. Why do the folks at The Hindu give pride of place (i.e., the op-ed page) to insipid crap like this:


when they have a much better talent on their payrolls, producing stuff like this, stuff which has to languish in the inner pages:

Tuesday, February 21, 2012

Quote of the day

"I am getting out in funny way, like flicking to point"
-- Virender Sehwag on his recent form

Don't know whether to laugh or to cry.

Thursday, February 02, 2012

The Goonda Regiment

The men in uniform are at it again, demonstrating that pesky little things like respect for the rule of law don't apply to them. A couple of questions for them: didn't you swear to protect the country -- which, last time I checked, includes its citizens -- when you signed up in the army? Does beating up innocent civilians who had nothing to do with your tiff with the police jibe with the oath you took? The excuse that the police behaved in an abusive manner does not cut it: two wrongs do not make a right. The particularly galling thing is that the violence was perpetrated not by jawans, but by fricking captains, who are supposed to set an example for the men they command (Update: it looks it was jawans). But then again, I guess this is in keeping with the state of things when you have a Chief of Staff hell-bent on clinging on to his position at any cost.

Tuesday, January 31, 2012

Where are we going?

(Warning: I don't know where I'm going with this post; I guess it ends when it ends)

I used to read Clusterfuck Nation and Club Orlov on and off in the past, whenever somebody in one of my regular haunts made a mention of one of their more noteworthy posts. I subscribed to their RSS feeds a while back (RSS is just like Twitter, except there is no 140 character restriction, and the content is slightly more meaningful than updates about celebrities' breakfasts *snark mode off*). A regular dose of doom and gloom stuff (maybe I should include Mish Shedlock's blog here as well), while fulfilling its disaster porn role, doesn't result in any constructive or positive outcome; for someone in India, being exposed everyday to the 'things have never been better, buy your dream car, your dream house, take your dream vacation, and while you're doing all this, tweet about it to your 1579 Facebook friends in real time using your ultra slim shiny smartphone' hard sell, this seems a world away, but is it really so? What would happen to us if the eurozone crisis finally comes to a head and countries start defaulting? If the price of oil goes through the roof because the USS Enterprise is torpedoed in the Straits of Hormuz? If there is a global ban on travel because of the next outbreak of bird/swine/monkey/rhino flu that came about because some scientist in a lab somewhere was wondering 'Gee, what would happen if I take this test tube of monkey piss and slightly shake it above the head of this disgruntled pigeon who has been looking askance at me since yesterday morning?'? What if the Indian real estate bubble finally bursts? What if the Sensex tanks? What if our exports took a nosedive, taking along with them the aspirations of the newly rich middle class? What if we run out of drinking water? Electricity?

The answer to these questions is pretty simple, really: a lot of people will be screwed, some more so than others. But how many of these scenarios will actually play out within the next year or so (ignoring the bits about electricity and water; I think we're safe on both fronts for another decade)?

One can go about analyzing these issues in a rational manner and doing our research, but this is not really needed; we can figure things out if we keep in mind certain things:

1. If bad things are coming down the pike, they will invariably be dumped on the people at the bottom of the food chain, those who cannot complain too much.

2. People in positions of power and wealth will game the system and get away with it every time.

3. No one can be proven right or wrong when it comes to principles of economics and ideology. The world is too complicated, there are too many variables, you cannot do double blind experiments with control groups, etc. In practical terms, this means that no philosophy or approach can ever be definitively disproved and jettisoned; any pundit worth his salt can rationalize away the failures and non-conformances to the 'model'.

4. People keep expecting the next messiah to solve all their problems. Not going to happen.

5. The kind of hyperinflation or currency crash similar to the experiences of the Zimbabweans or the Wiemar Republic will not happen with either the dollar or the euro.

6. When people in power are in trouble, watch out for distractions, both catastrophic (Iran vs USrael) and merely irritating (retail FDI controversy, Salman Rushdie). Also be prepared for dirty tricks. These people have too much vested in the status quo to go without a fight. They're are also very smart (which is a given considering where they are and how long they have remained there). Cf. Women's reservation bill, Lokpal bill.

7. Everybody has their price.

Applying these, for want of a better term, principles, to all the questions raised above is left as an exercise for the reader.

Friday, December 02, 2011

The Retail FDI Controversy

With all the noise and disruption of parliament over the allowing of FDI in the retail sector, who's now talking about the Lokpal bill? Mission accomplished.

Tuesday, November 22, 2011

pLisp v0.1 released

pLisp (The 'p' stands for 'personal', at least as of now) is an interpreter for a Lisp-1 dialect I have been working on. I had four broad objectives when I started out:
  1. Use the experience to learn Lisp at a much deeper level than what a casual user would attain
  2. Build my own language/development environment, one that I would use for all my personal projects from now on
  3. If I manage to take the project sufficiently forward, build a Lisp development environment for newbies that rivals those of Smalltalk
  4. Use pLisp as a test bed for new research ideas related to programming
I think things are sufficiently mature enough to warrant a 0.1 release, although a not-infrequent assertion failure or segfault cannot be ruled out.

These are the features currently supported:
  1. Basic operators like CAR, CDR, and other language primitives (cf. Paul Graham's 'Roots of Lisp')
  2. Other operators and utility functions written in pLisp itself (there is a rudimentary library at present)
  3. Error handling in the form of an '(error "...")' operator
  4. Garbage collection
  5. A somewhat buggy foreign function interface
  6. Ability to store and load images (aka serialization)
  7. Macros
  8. A rudimentary debugger (step, break, resume, abort)
  9. A package system
TODO list:
  1. More comprehensive error handling; there are a lot of places where sanity checking of parameters is absent, leading to assertion failures or core dumps
  2. Enhancements to the core library
  3. Graphical development environment
  4. Compiler
  5. Continuations and implementations of other 'cool' research ideas
pLisp uses tpl for serialization and libffi for the foreign function interface.

Sunday, October 09, 2011

October 9, 2011

Some random thoughts on the ongoing Rugby World Cup:

1. I've really made an effort to understand the nuances of the game and enjoy it, but it's not easy. The most important thing to keep in mind is that there is only a single line of defence to stop the attacking team from piercing through and running all the way to score a try. This, coupled with the 'no forward passing' and offside rules, pretty much dictates the dynamics of the play. But there is still an element of ugliness to the game, most notably exemplified by the pile of bodies that takes place during a ruck. We have no idea what's happening inside, where the ball is, and so on (wonder how the referee keeps on top of things, short of jumping into the orgy himself). Things are not clean and simple, so to speak (compare this to football: 'you can only kick the ball with your foot; now try and put the ball between the two posts'). The skill displayed by a player is not readily apparent to someone who is not a fan of the sport.

2. Speaking about the refs, it's refreshing to hear the referee (and the adjudicating referee) on the microphone most of the time. More transparency this way.

3. The small number of fouls is quite amazing when compared to, say, football (not talking about technical violations here). My theory is that the 'almost anything goes' nature of the game does away with the need to commit physical fouls. Who needs to break the law when you can legally do a number on your opponent? Rugby players can both dish out and take stuff, unlike footballers who writhe on the ground in feigned agony if an opponent so much as looks at them funnily.

4. Notwithstanding the fact that it takes more strength and stamina to go through 40 minutes of non-stop action than to get through a comparable period in American football, American football is eminently more watchable. The skipping of the heartbeat every time the quarterback is about to pass the ball is missing. There are exhilarating moments in rugby too, like for example when a player dodges the defence and is streaking towards the tryline, but these are few and far between. The strategizing, playbooks, etc. of American football is missing (or maybe I can't figure things out on account of my noobiness).

5. The pre-match war dance (saw the New Zealand team do it today) is extremely silly. Sure, some opponents may get freaked out by a bunch of brutes grunting in tongues, crowing about how they will shove their brawny and tattooed arms up their opponent's asses and punch their intestines black and blue, but any half-intelligent person is more likely to struggle to not double up on the ground with laughter.

Saturday, September 24, 2011

Obama's actually right

Peace will not come through statements and resolutions at the UN. Only wars of aggression, crimes against humanity, and the murder of innocent men, women and children do.

While asking for full membership at the UN is a positive thing, as long as things are decided by the five veto-wielding so-called superpowers, the UN is as good as non-existent. In fact, at least the child-trafficking and other abuse would stop if it were disbanded.

Monday, September 19, 2011

September 19, 2011

One of my pet phobias is large objects. It's not exactly a phobia per se, but more of a slight shiver that runs down (or up?) your spine for a fleeting moment and you quickly think of shining happy thoughts to distract yourself. I think this had its genesis in the movie The Independence Day in which, if I remember correctly, a spaceship a few miles in diameter fills the sky above Washington, DC.

Now just imagine that it's not a spaceship, but the planet Jupiter, and that it's not a few miles in diameter, but is 71,492 fricking miles from one end to the other, and is so big that your entire sky is but a closeup of the planet's terrain.

You don't have to imagine this, actually. You can see a simulation video.

Sweet dreams, here I come.

Saturday, September 17, 2011

Speculators Behind 2008 Oil Shock

Via Rigorous Intuition:
Leaked Documents Reveal Major Speculators Behind 2008 Oil Price Shock

Last month, Sen. Bernie Sanders (I-VT) leaked confidential data about oil speculation to a number of media outlets, including the Wall Street Journal. Ordinarily, the Commodity Futures Trading Commission, the regulatory body that oversees futures trading, does not provide identities of speculators to the public. However, the data leaked by Sanders provides a rare snapshot into the trading volumes by major speculators right before the oil price spike in the summer of 2008.

As experts from Stanford University, Rice University, the University of Massachusetts, and authorities have concluded, rampant oil speculation was the prime driver of the record high prices for crude oil three years ago.
Ahem.

Wednesday, August 17, 2011

August 17, 2011

Simi Garewal's "India's Most Desirable" is my least favourite program on TV, even beating the likes of the 1876th rerun of the documentary "Hum Apke Hain Kaun". Sixty minutes of mindnumbing prattle from celebrities, interspersed with coy, pretending-to-be-hard-hitting questions from Simi (she must be, what, 98? Pity she wasn't born three thousand years ago in Egypt; she would have made a killing licensing the formula for her embalming potion to the pharaohs).

Not content with just Indian celebrities, there are plans to rope in Lady Gaga as well. That ought to be fun to watch: Queen Tut vs Lady Tut Tut...

Friday, August 12, 2011

August 12, 2011

I recently finished reading The Black Swan (well, I've yet to start the extended essay that has been added to the second edition, but still). A moderately interesting read, with a few intriguing and insightful ideas, but there is no satisfaction at the end, the satisfaction that comes from reading a book that puts its key messages in a tight-knit, coherent form and packs a good punch, so to speak. The book would also have benefited from a better editing process -- the language doesn't flow that easily in quite a few places. A good thing I got this book as a gift and didn't have to spend money out of my pocket.

The author's contempt for CEOs, Frenchmen, and academics (economists in particular) also comes through too strongly and bitterly -- this is probably his F*** You Money talking. Somewhat ironical, considering that there is a quote from a trader in the book along the lines of "Be nice to people on your way up, since you'll meet them on your way down". He could also have gone a bit easy on the frequent attempts at cheap titillation through mentions of prostitutes, how many lovers did Catherine the Great have, and so on.

With respect to the meat of the book, can't really disagree with the author's contention: we do not know what we're doing half the time, unknown forces are lining up against us as we speak, it's no use trying to do long-term (maybe even short-term) predictions, and our brains are hardwired to see patterns where none exist and are prone to all kinds of cognitive biases (on a side note, this paper does a more thorough job of this). Scalability is a theme that runs through the book -- be it scalable/non-scalable professions (the relation between the amount of money one makes and the physical number of hours put in -- e.g., doctors/plumbers vs hedge fund managers) or scalable odds (Gaussian vs Mandelbrotian).

While on the subject of scalability and the medical profession, today I learned that one can get an *ahem* discount of Rs 5000 on an MRI scan bill of Rs 8000 if the doctor is kind enough to not ask for his commission from the diagnostics center.

Saturday, July 30, 2011

GitHub

I've finally gotten around to collecting all my code in a single place. This is a pretty much complete collection, except for my JSON implementation for VisualWorks. A recent scare with my home laptop (a faulty chip related to the display) is the reason for this. I have an external drive where I periodically back up stuff, but I was not able to access my files during the absence of the laptop. I could have taken them from the external drive, but didn't want the hassle of again bringing the laptop contents in sync; not to mention I didn't have much time during this period due to a family emergency.

Thursday, July 14, 2011

Predicting the English Premier League - Part 2

As promised, here are the results of the number crunching. Some of the number crunching is still ongoing as I type this -- to figure out which of the parameters give the best results (the code in the AWS instance is running for six days; hopefully it will terminate before I hit the free tier limit of 750 hours).

First, a list of the prediction methods considered:

1. Homegrown method 1: In this method, we consider three parameters: home advantage, total form and recent form (three matches). Whichever team comes out on top on the cumulative score based on these three factors is designated the winner (no draws in this method).

2. Homegrown method 2: This method uses historical (this season only) values for fractions of home wins, draws and away wins; generates a random number between 0.0 and 1.0, and chooses one option based on where the number falls in the spectrum (length of each segment in the spectrum (HW, DR, AW) determined by the historical averages).

3. Random: Generate a random number between 0.0 and 1.0. If this is <= 0.33, it's a home team win; if it's between 0.33 and 0.66, it's a draw; otherwise it's an away team win.

4. Linear (GLM): The generalized linear model with least squares regression.

5. KNN: The K Nearest Neighbours method. There are two variations to this -- one where we simply consider the three classes as home win, draw, and away win; the other where we convert the three classes to real numbers. We also vary the number of neighbours considered from one to three.

Some general notes about the exercise:

1. We use data from match-week 10 to match-week 21 (inclusive) as training data for GLM and KNN

2. Predictions are for match-week 22 onwards

3. All match-weeks do not have the same number of games for various reasons (scheduling, snow, etc.)

4. These are the predictors used:
  • Home record of home team
  • Away record of away team
  • Total record of home team
  • Total record of away team
  • Most recent (three matches) record of home team
  • Most recent (three matches) record of away team
  • Goal difference of home team
  • Goal difference of away team
  • Rank in points table of home team
  • Rank in points table of away team

Here are the results of the prediction, first in table format, followed by graphs (click to enlarge):





As I mentioned earlier, pretty 'meh' results. Maybe the brute force method to identify the best parameters will yield something better. This method basically considers all the combinations of parameters from the above ten, and computes the average accuracy of prediction -- for the same training data and the same prediction period -- for all of them, and picks the combination (there are actually two combinations, one for GLM and one for KNN) with the highest value. But I'm not holding my breath.

Update: The brute force number crunching is finally done and the results are in. KNN (n=3) with classes, with two three parameters -- the away record of the away team and the total record of the home team the most recent records of the two teams and the rank of the home team -- gives the most accurate predictions:

Wednesday, June 08, 2011

Quote of the Day

“I am the president of FIFA; you cannot question me” -- Sepp Blatter, President of the Federation of Insufferable F**tards Associations

Lisp Compiler

I am working through "An Incremental Approach to Compiler Construction". Great fun. I started reading Lisp in Small Pieces (LiSP) a while back, but this paper is a more hands-on, tutorial approach; you're able to see the fruits of your labour sooner and measure your progress better. It would have helped more if I could have gotten my hands on the extended tutorial that is supposed to accompany the paper -- it seems to have disappeared from the web. Anyway, tackling the project with only the paper for company is more challenging.

Both this paper and LiSP use Lisp dialects as the source and implementation languages. While this has a number of advantages (can't imagine using C or C++ as the implementation language *shudder*), there is a minor drawback (I say minor because the benefits far outweigh the costs; most notably a) the joy of coding in Lisp and b) the obviation of the need for a parser) -- when you're writing regular Lisp code, you are juggling with the concepts of compile-time, run-time and read-time (to be fair, I haven't felt the need to concern myself with read-times yet), whereas when you're writing a Lisp compiler in a Lisp dialect, you now have two sets of these times to contend with -- one for your compiler and the other for your generated code. Moreover, there are transformations that convert the source expressions into simplified Lisp expressions in the source dialect, which adds to the fun and merriment. You are writing Lisp code that is acted upon by Lisp code, which then takes a quoted Lisp expression and produces another quoted Lisp expression, which is then acted upon by yet another piece of Lisp code which generates the equivalent assembly... As I said, great fun.

On second thoughts, I'm not sure whether the point about two sets of times (read/compile/execute) is really valid. The complexity mentioned at the end of the previous paragraph captures the situation more accurately.

Tuesday, May 24, 2011

May 24, 2011

The two most powerful human emotions are said to be relief and love, and this was borne out with the closure of the EPL season this weekend. There is something pathetic, and at the same time endearing, about supporters going berserk because their team scores a goal that is neither the equalizer nor the winner, but is one which enables their goal difference to climb above that of their fellow languishers in the relegation zone.

Speaking of the EPL, I have persevered in the data collection process, i.e., I have the full 38 weeks' worth of match results fed into the predictor. Time for some analysis, and hopefully, insights. Stay tuned.

Thursday, May 05, 2011

May 5, 2011

Listening to Harsha Bhogle's inane and faux cheerful prattling has always been an ordeal. I finally figured out a way to handle this (other than using the mute), based on a contrived answer to the question "Why is Harsha Bhogle so happy?" The real answer is, of course, that Harsha Bhogle is so happy because he makes shitloads of money, he's a celebrity, he's got a nice rug, and so on, but that's not the road we are going to go down. What if the reason for the overdose of cheerfulness is that he's not really happy at all, but that His Bubbliness' behaviour hides a dark secret? A secret never revealed to anyone, a secret that festers in his mind every single waking second, a secret that can only be kept at bay by focussing solely on the shining happy things in life, like the way the sunlight dances off Danny Morrison's shiny pate, like the significance of the fact that the number of stumps on both sides of the pitch are wonderfully symmetrical and equal, like how quaint and innocent is the fat lady screaming her head off in the stands when the camera is on her, like how wonderful it would be to have Kiss Cams in the IPL so we can catch geriatric couples expressing their undying devotion for each other before the entire world...

Sorry, I got carried away a bit there.

Anyway, getting back to the dark secret, if you listen to Harsha Bhogle with this backstory [*] in mind, your irritation vanishes completely, to be replaced by a tender pity for the poor man, and you almost want to pull him close to your chest, a la Robin Williams and Matt Damon in Good Will Hunting and repeatedly whisper "It's not your fault" (I said 'almost' because, you know, you don't want to get too close to the rug, considering that it will be just below your nose, with Harsha Bhogle discharging copious amounts of tears on your clean new shirt).

On second thoughts, maybe it was his fault -- I can picture him as a small child saying, "Uncle, do you think stars are God's puppies? Isn't it wonderful the way they twinkle 'Woof! Woof!' all night long? Uncle, why are you looking at me that way...?"

Man, I can't wait to watch the match today and put this theory to test.

[*] Since this is a family blog, I don't want to speculate on the dark secret, but being the sadistic bastard that I am, I'll just throw in the words 'uncle' and 'broom handle'.