The true cost of FREE!

I just finished reading this wonderful book: Predictably Irrational by Dan Ariely. It describes how we systematically behave irrationally, hence making it predictable. Although I consider myself a fairly rational person, I must confess I’ve acted rather irrationally a few times in the past (Ah, to be young and foolish). I would’ve thought that those were erratic, one-off cases but the book presents a case that there are patterns underlying our fallibility. One pattern that really resonated with me was how we behave irrationally around zero cost. There’s a particular allure for free stuff.

Continue reading

When to invest in mutual funds: An exercise in data science

I started with an interesting hypothesis: “Some days are better than others for investing in Indian mutual funds for buy-and-hold approach“. There’s nothing particular about mutual funds or India; it should apply to most investment vehicles and other countries but I have been investing in Indian mutual funds and wanted to know if I could do better by investing more on some days than others. There’s a story behind this hypothesis. A friend of mine said his financial advisor told him that their data showed, on average it’s better to invest:

  • during the second half of the month
  • on odd days
  • on Tuesdays, Wednesdays, Thursdays as compared to Mondays and Fridays

I guess we can come up with many stories for why these hypothesis may be true. People in India generally get paid on the last day of each month and have more money during the first half of the month than the second (It’s a different story in USA where most people get paid twice a month but have to pay rent etc. at the start of the month. They should have more disposable income during the second half.), so NAVs for mutual funds may be lower during the second half because on average, more people will buy during the first half and more people will sell during the second half. Since market is closed on Saturdays and Sundays, people might take more extreme positions during Mondays and Fridays and if you are investing for long term, it might be better to stay away from extreme positions. I couldn’t come up with any story for odd days but in any case, that’s all these are, stories.

Continue reading

What I learned after coming to the US

Pardon the clickbait title, but there was no easy way to get my friends to learn about 401K, HSA and similar “boring” things. Quite a few of my friends are coming to the US in the next few months and if I can summarize my experiences and my many hours of research, it should help them get up to speed quickly and avoid making the same mistakes I did.

Let’s start at the beginning. I came to the US from India, mid-march this year on an L-1B visa. Some of my experiences may only be relevant to those coming from India but most should be relevant to anyone coming to US on a work visa.

Continue reading

Bit fiddling: Exercise that grey matter

It’s been nearly two months since my last post. I was seriously low on motivation. I thought I’d try changing the format a little back: add a little more personal narrative and write about things I’m currently reading instead of something I read a while back and must research again.

Let’s start with some bit hacks. I’m currently reading this book Hacker’s Delight. Make no mistake, you are probably never going to use this stuff in your professional code. The first law of programmer creativity is that “The cost of software maintenance increases with the square of the programmer’s creativity.”. But it’s a good exercise for your brain cells and it’s nice to know that you can understand your code down to the bit-level. So let’s do some exercises.

Continue reading

GGP: Monte Carlo Search

In the previous post, we looked at a heuristic-based general game player, which worked for single player and two player zero-sum games. There are a few problems with this approach though: We need to come up with a good heuristic for the game at hand but more importantly, heuristics exploit local properties of states (properties that do not depend on the game tree as a whole) and for many games, there may not be any correlation between these local properties and global success. It would be better if we didn’t have to come up with a heuristic; if the heuristic was somehow built into the search algorithm itself i.e., the algorithm were itself capable of ordering the moves, and the ordering depended on the whole game tree instead of local state properties.

Continue reading

A simple heuristic-based General Game Player

In the previous post, we talked about general game playing. Now let’s build a simple general game player, using the algorithms that we’ve already seen (Iterative deepening DFS and Iterative Deepening Alpha Beta Search).

Continue reading

Introduction to General Game Playing

So far, we’ve talked about designing agents for specific single player and two-player zero-sum games, using heuristics to guide the search, and saw how we can model and tackle uncertainty in move generation. It’s finally time to discuss General Game Playing (GGP).

Continue reading