Tuesday, November 06, 2012

Predicting the English Premier League - Part 3

Having just completed the machine learning course in Coursera, time to put the knowledge to good use. Neural networks seem to be the most promising among the classification algorithms (logistic regression and SVMs being the others covered in the course) -- I did do bit of mucking around with logistic regression, but the results were singularly disappointing.

Since we're dealing with neural networks, no need to be picky with what features to use; in addition to the ten parameters considered the last time, let's throw in as many additional ones that we can think of, and let the algorithm sort it out. Here are the features forming the input layer (the features are normalized -- something I didn't do the last time):
  1. Home record of home team
  2. Away record of away team
  3. Record of home team
  4. Record of away team
  5. Record of home team in last three games
  6. Record of away team in last three games
  7. Record of home team in last five games
  8. Record of away team in last five games
  9. Record of home team in last seven games
  10. Record of away team in last seven games
  11. Record of home team in last three home games
  12. Record of away team in last three away games
  13. Record of home team in last five home games
  14. Record of away team in last five away games
  15. Record of home team in last seven home games
  16. Record of away team in last seven away games
  17. Total goals scored by home team
  18. Total goals scored against home team
  19. Total goals scored by away team
  20. Total goals scored against away team
  21. Position of home team in points table
  22. Position of away team in points table
We use one hidden layer with five activation units -- could've used more hidden layers, but the code I wrote for the course assignments is for a single hidden layer, and I'm too lazy to bother to make the code more general. Not to mention that the efficacy of using more layers is moot.

The examples are a total of 560 matches from the 2010-11 and 2011-12 seasons (we ignore the first few weeks of each season to a) get things to settle down and b) avoid division-by-zero errors for some of the features (e.g. when we're considering the first match a team plays in the season).

350 matches are used as the training set and 30%, i.e. 105, from the remainder form the cross validation set.

After a lot of number crunching, the results are not too good, at least not yet. It looks like I'll be needing more data (as indicated by the results from the learning curve plots). A lambda value of 0.16 or 0.32 seems to be the most promising.


The next step is to get the results for the 2009-10 season -- and earlier if required. More grunt work. Stay tuned.

Update: Well, I went all out and got the results for three seasons -- 2007-08, 2008-09 and 2009-10 -- but no cigar; the prediction accuracy refuses to go above ~50%, whatever values of lambda and feature list I consider (I added two more features to the above list: total games played so far by both teams). It might be possible to squeeze out a bit more by running a genetic algorithm and figuring out the best lambda value and features, but I don't think the effort is worth it. Question: what is the minimal prediction accuracy required to get a 20% return on bets over the long-term, e.g., over an entire season?

Friday, November 02, 2012

Question of the day

"After hundreds of drone strikes, how could the United States possibly still be working its way through a 'top 20' list?"
-- Gen. Ashfaq Parvez Kayani to Adm. Mike Mullen

Sunday, October 28, 2012

October 28, 2012

Imagine a slightly larger-than-life statue of a naked boy-man wearing only the remnants of a pair of jeans and a hat that looks like a flak helmet, his foot resting on the severed, blood-dripping head of a Roman legionary.

Oh wait, you don't have imagine it. Here's an actual picture:


Picture courtesy of the Rock Garden, Malampuzha, Kerala. I'm too lazy to google for it, but I bet there is a back story involving a twisted and diseased mind that spawned the whole house of horrors (the above picture is only a sample; there's a lot more cringe-inducing crap in my vacation pictures folder). 

Saturday, September 29, 2012

September 29, 2012

Comment of the decade (on Business Insider's 1068th Marissa Mayer story):

Is Farrukh Dhondy aware of Nafeez Ahmed's post about Abu Hamza's links with MI6? The sad part is that the visibility such an op-ed column gets is orders of magnitude greater than what Nafeez Ahmed's writing does.

Thursday, September 20, 2012

September 20, 2012

The Hindu on allowing FDI in retail:
Even within the retail trade, the government’s claim that FDI is good for the nation is difficult to defend. The success of large retail cannot be based only on the expansion of the retail space, but requires acquiring a share of the existing space occupied by small retailers. NSSO data for 2009-10 indicate that the occupational category consisting largely of the wholesale and retail trade employed 44 million Indians. The displacement of a substantial number of these workers is inevitable. Since the economies of scale and scope that size delivers in organised retailing are expected to reduce costs by raising labour productivity, the expansion of large retail will not compensate for this employment loss.
Which reminds me of this comment by 'StarmanSkye' at RI:
 I guess the New Politics of neo-Conservative values which we see in the unprecedented official government protection that encourages the power & privilege of the financial criminal class suggests a kind of logical argument can be made that the trend from "Its the duty of every American industry, company, corporation, business person and citizen to maximize their profits by any *legal* means allowed, including evading, deflecting, eliminating or deferring their tax liability" leads to:
"Its the duty of every worker to inhibit productivity by any and all means *legally* allowed so as to stimulate maximal employment of the work force".
Game, set and match.

Thursday, September 13, 2012

September 13, 2012

Rotten meat? More like local traders being undercut by low-cost 'imports' from neighbouring states protecting their turf by siccing the authorities on the pretext of hygiene.

Reminds me of restaurant owners suddenly developing concern for their patrons and trying to protect them from the unhygienic food in roadside eateries some time back.

Thursday, September 06, 2012

September 6, 2012

Well, Mish finally addressed the real estate scenario in India and, as I expected, didn't have nice things to say about it.

There are times when you hear so many good things about something -- be it a book, a movie, or a song -- and when you finally get around to reading/watching/listening-to it, the experience is quite underwhelming because of the raised and unrealistic expectations. Cryptonomicon falls into this category for me. While portions of it were good reading (especially the crypto anarchy bits), overall the book simply rambles on and on for 900+ pages. The fact that I enjoyed Bruce Schneier's appendix on the Solitaire crypto system more than at least 50% of the book says a lot.

Monday, August 13, 2012

August 13, 2012

The Hindu on the trial of Gu Kailai:
However, a detailed account of the prosecutor’s case that emerged late last week has provided rare insights into the dealings of one of China’s most popular politicians, who was a key figure in the 25-member Politburo before his suspension in April. Part of the account was released by the official Xinhua news agency, while other details came from an Anhui student who sat in on the court’s proceedings. His account was independently verified by a lawyer who was present in the courtroom.
Read that again carefully. They're not talking about the lack of transparency regarding the government in China -- contracts, policies, and so on; they're talking about the lengths one has to go to to even know how the trial is being conducted. It's not like state secrets would be laid bare if the proceedings were not held in camera (so to speak); this is just a plain old murder case. But again, this is China we're talking about. There is a good chance that a body double would serve Ms Gu's sentence out.

On a related note, we're once again reminded of the questionable non-merit-based admission policies of Ivy League universities.

Friday, August 10, 2012

August 10,2012

Nicholas Kristof (emphasis mine):
US President Barack Obama's finest moments in foreign policy, like the Osama bin Laden raid or the Libya intervention
Stopped reading right there. Mr Kristof, welcome to the kill file. We have some delightful companions for you there.

Thursday, August 09, 2012

Monday, July 30, 2012

July 30, 2012

The Hindu's policy regarding online comments:
  1. Comments will be moderated
  2. Comments that are abusive, personal, incendiary or irrelevant cannot be published.
  3. Please write complete sentences. Do not type comments in all capital letters, or in all lower case letters, or using abbreviated text. (example: u cannot substitute for you, d is not 'the', n is not 'and').
  4. We may remove hyperlinks within comments.
  5. Please use a genuine email ID and provide your name, to avoid rejection.
I can see where they're coming from with respect to #3 -- they don't want their pages to be polluted by the Neanderthals hanging out at rediff.com -- and find their grammar nazi behaviour naive and endearing, but I still think their backsides need a strong and liberal application of the cluestick.

Tuesday, July 10, 2012

July 10, 2012

Quote of the day: "Next, we'll probably hear that Lloyd Blankfein over at Goldman Sachs has been tinkering with the rotation of the earth in order to gain a few micro-milliseconds of advantage in his firm's high frequency trading rackets."
-- James Howard Kunstler

There has been a lot of commentary about the confusion regarding the name of the Indian prisoner released from Pakistan. In particular, somebody mentioned that the returning (pardoned) prisoner should keep his trap shut and not blab about being a spy for India, as this makes the task of negotiating the release of other such people all the more difficult. Can't really fault this logic, but I have more fundamental issues: why are we sending folks into enemy territory to engage in such acts (not to mention bombings, if the allegations against Sarabjit Singh have any merit)? This may be a naive view of how foreign policy is conducted, but ahem, we are different, aren't we? Ours is the land of Gandhi and the Buddha -- we would never do these things, things that only other countries do, would we? In my rule book, if a fair and impartial trial (best conducted by a disinterested third country like, say, Iceland (I wanted to say Norway, but some folks may remonstrate against this since Norway is -- was? -- involved in mediation efforts in Sri Lanka and may not fully qualify as a disinterested party)) shows that Sarabjit did commit these things he's accused of, he should hang. Period. No 'My country, right or wrong', 'But he was only doing his patriotic bit for the country' business. Patriotism is taking a gun and defending your border against an enemy, not terrorism or other nefarious activities that would get you peremptorily -- and legally, I think -- executed in wartime. One positive fallout of such an action would be that we can mete out the deserved justice to Kasab as well, instead of waiting on him hand and foot in prison. This will also open the eyes of gullible folks who get railroaded into doing James Bond duty for the country.

Friday, June 15, 2012

Quote of the day

"... at times, it was like watching a practice game involving ten green traffic cones as Spain cut Ireland apart.
-- On Ireland's exit from Euro 2012

Ouch.

Wednesday, June 13, 2012

The JEE Controversy

Some thoughts on the JEE controversy (disclosure: I received my bachelor's degree from IIT Madras):
  1. There is merit to the argument that IITs have not fulfilled their mission of making India a science and technology powerhouse. There is a big disconnect between the quality of the undergraduate students (leaving aside the dilution of the standards in recent years) and the quality of the engineering and R&D output produced. Also, a very small fraction of the undergrads take up careers related to their majors (I too am guilty of this). However, this argument is orthogonal to the problem of determining the best way to admit students to engineering colleges in India.

  2. Having each IIT conduct its own entrance examination is not the answer. Subjecting a high school student to, say, 15 entrance examinations borders on child abuse.

  3. The UPA government seems hell-bent on wreaking havoc with the IITs. First it was the increase in the number of IITs, now this. There is a strong lobby of bureaucrats and other elites who want their wards to go to prestigious institutions like the IITs, but are stymied by pesky things like the JEE. The more enterprising of them wangle admissions from top American universities using their connections -- don't even get me started on the backdoor alumni recommendation route that gets somebody like Bush Junior into Yale; god forbid the day such a thing becomes reality in India. The reservation for other backward classes is also an attempt by the elites in this direction. If you can't beat 'em, dilute 'em.

  4. One of the charter goals of the alumni associations should be to protect the IIT brand. I have not been recently involved in the goings-on of the IITM alumni association, so I don't know if this is being taken up. If things continue to progress at this rate, there may come a time when degrees from the IITs are accorded the same respect as those from some of the more infamous colleges in Chennai (one would be surprised to know of the esteem those degrees were held in two or three generations ago).

Friday, June 01, 2012

June 1, 2012

Well, it took three years for my prediction to come true. "We cannot wait forever" -- indeed, how magnanimous of you.

Tuesday, May 29, 2012

May 29, 2012

IPL 5 is over. While the matches provided a lot of excitement, I would be more convinced about the genuineness of the whole thing if someone did an analysis of the numbers and proved that there were no match/spot fixing shenanigans. One thing that comes to mind is no balls: some statistical significance studies on the number of no balls bowled versus the bowlers and at what stage in the match they were bowled, was it a touch-and-go decision or was it blatant overstepping, and so on.

Having recently witnessed the scenes of celebration at the Etihad Stadium, the contrast with the IPL final could not have been starker. The inordinate focus on the owner -- who might as well have worn a clown costume, by the way -- instead of the players who made it happen, the lack of genuine grassroots support (Usha "Look at me, I have a whistle in my mouth" Uthup, Juhi Chawla and other assorted celebrities trying to warm themselves in the spotlights do not count), the contrived joy and enthusiasm of the players who did not figure in the playing eleven -- there is a difference between waiting 44 years for a trophy as compared to five.

Monday, May 14, 2012

May 14, 2012

"Some people believe football is a matter of life and death, I am very disappointed with that attitude. I can assure you it is much, much more important than that"
-- Bill Shankly

You don't care about the quality of the passing, the skills on display, or the individual brilliance. The only thing that matters is that the ball crosses the line between the goalposts, and twice at that. The tears that slowly begin to roll when it looks like it's all over, the look of despair that turns into joy (and vice versa for the United fans -- a bonus if you're a staunch anybody-but-United guy like me), Aguero's shirtless run towards the corner flag, Joey Hart terminating the interview on account of becoming overwhelmed by the situation, the commentator's schadenfreude ("How will the fans face somebody in a red shirt this evening? How will they have the moral fiber to get up tomorrow morning and go to work...?" Fuck you.) turning into astonishment.

The Beautiful Game? No, but this is football.

On a personal note, I'm not even a City fan, but the euphoria I felt when they scored the winner was comparable to what I felt when Del Piero scored in the 2006 World Cup semi-final.

Oh, and by the way, I stubbed my toe quite hard when I jumped up from the couch to celebrate. Still hurts, but totally worth it.

Thursday, May 10, 2012

May 10, 2012

The Times of India might as well rechristen themselves as The Pimps of India.

There is a reason they sell the paper for less than 25 bucks a month: it isn't their readers they make their money from.

Wednesday, May 09, 2012

May 9, 2012

Yesteryear's heartthrob
Is it trademark shake of head?
Is it Parkinson's?


The Havells ad featuring Rajesh Khanna has to be the most depressing thing I've seen on TV for some time.

Monday, April 30, 2012

April 30, 2012

This is probably a hoax, but intriguing all the same.

Staying on the subject of pop culture and hip hop, have you ever watched a movie that was so bad that it went around the world and became good when it came back? Something along the lines of music that gets voted the worst and climbs the chart because of this? Well, I watched such a move yesterday (Torque, in case anyone's interested). Bad (or non-existent, since we're talking about Ice-Cube here) acting, cliched dialogue (case in point: "Don't pick on girls", says the resident bimbo after boinking a bad guy -- my brain cells are still tingling at this repartee), you name it, this movie had it. My only regret is that I couldn't watch it till the end. Just kidding. Maybe not.