Category Archives: Technology

Proportionate A/B testing

More than once I’ve seen people ask questions like “In A/B Testing, how long should you wait before knowing which option is the best?”.

We’ve found that the best solution is to avoid a binary question of whether or not to use a variation. Instead, randomly select the variation to present to a user in proportion to the probability that this variation is the best based on the data (if any) you have so-far.

How? The key is the beta distribution. Let’s say you have a variation with 30 impressions, and 5 conversions. A beta distribution with (alpha=5, beta=30-5) describes the probability distribution for the actual conversion rate. It looks like this:

A graph showing a beta distribution

This shows that while the most likely conversion rate is about 1 in 6 (approx 0.16), the curve is relatively broad indicating that there is still a lot of uncertainty about what the conversion rate will be.

Let’s try the same for 50 conversions and 300 impressions (alpha=50, beta=300-50)”):

You’ll see that while the curve’s peak remains the same, the curve gets a lot narrower, meaning that we’ve got a lot more certainty about what the actual conversion rate is – as you would expect given 10X the data.

Let’s say we have 5 variations, each with various numbers of impressions and conversions. A new user arrives at our website, and we want to decide which variation we show them.

To do this we employ a random number generator, which will pick random numbers according to a beta distribution we provide to it. You can find open source implementations of such a random number generator in most programming languages, here is one for Java.

So we go through each of our variations, and pick a random number within the beta distribution we’ve calculated for that variation. Whichever variation gets the highest random number is the one we show.

The beauty of this approach is that it achieves a really nice, perhaps optimal compromise between sending traffic to new variations to test them, and sending traffic to variations that we know to be good. If a variation doesn’t perform well this algorithm will gradually give it less and less traffic, until eventually it’s getting none. Then we can remove it secure in the knowledge that we aren’t removing it prematurely, no need to set arbitrary significance thresholds.

This approach is easily extended to situations where rather than a simple impression-conversion funnel, we have funnels with multiple steps.

One question is, before you’ve collected any data about a particular variation, what should you “initialize” the beta distribution with. The default answer is (1, 1), since you can’t start with (0, 0). This effectively starts with a “prior expectation” of a 50% conversion rate, but as you collect data this will rapidly converge on reality.

Nonetheless, we can do better. Let’s say that we know that variations tend to have a 1% conversion rate, so you could start with (1,99).

If you really want to take this to an extreme (which is what we do in our software!), let’s say you have an idea of the normal distribution of the conversion rates, let’s say its 1% with a standard deviation of 0.5%.

Note that starting points of (1,99), or (2,198), or (3,297) will all give you a starting mean of 1%, but the higher the numbers, the longer they’ll take to converge away from the mean. If you plug these into Wolfram Alpha (“beta distribution (3,297)”) it will show you the standard deviation for each of them. (1,99) is 0.0099, (2,198) is 0.007, (3, 297) is 0.00574, (4, 396) is 0.005 and so on.

So, since we expect the standard deviation of the actual conversion rates to be 0.5% or 0.005, we know that starting with (4, 396) is about right.

You could find a smart way to find the starting beta parameters with the desired standard deviation, but it’s easier and effective to just do it experimentally as I did.

A (possibly) novel approach to image rescaling

We’ve all seen fictional examples of increasing the resolution of images to reveal previously unseen detail, here is a reminder:

Unfortunately, all of these examples are basically impossible, because they imply revealing information in the image that simply isn’t there.

Turns out that there is a way to do exactly this, described by this paper: Scene Completion Using Millions of Photographs.

So, anyone want to try applying this approach to “filling in” the missing pixels in an image that has been scaled up? The results would be really interesting.

Another year, another way to host my blog

Two years ago, almost to the day, I switched to using Squarespace for my blog hosting. To quote my reasons at the time:

Well, I’ve switched blog engines once again. Several months ago I switched from a self-hosted WordPress to the WordPress.com service, because my blog kept getting hacked due to security holes in the open source version of WordPress.

But WordPress.com was far from perfect, they are very restrictive about what you can put on your blog (so no tools like Woopra or Google Analytics), only a small selection of approved plugins.

So I’ve decided to switch again, this time to SquareSpace. They let you use your own embedded code, which means I can now use the analytics system of my choice, and other neat tools like Google’s Prettify script.

Unfortunately it turned out that Squarespace has shortcomings of its own, and recently they became unbearable. Basically the problem is comment spam. Almost every one of my blog entries, especially the popular ones, had tens of spam comments. On my blog as a whole there may have been as many as a thousand. Whatever mechanisms Squarespace has for preventing comment spam are evidently ineffective.

Worse, Squarespace provides no convenient mechanism to delete comment spam en-masse, which would have meant spending hours deleting them manually, only to have them reappear at some later date.

My original reasons for moving away from self-hosted WordPress was that it was insecure and kept getting hacked. At the time this was especially damaging as the server hosting my blog was also used for other things, and they could have been compromised.

Well, it seems like the security situation may have improved with WordPress, and they have made it much easier to keep up-to-date with the latest version, so I’ve decided to try it again.

Hopefully I won’t regret it :-/

Google Wave goes public but misses obvious viral opportunity

So Google Wave has opened its doors to the public – yay!

Now you can just create a Wave, and enter anyone’s email address and they will automatically be invited, and signed up for Wave if they don’t already have an account – right?  

Wrong.  If you try you get an unhelpful message telling you that they aren’t a Google Wave user:

 

How Google could miss this completely obvious opportunity to ensure viral adoption of Google Wave?

What should happen is as I described it – from my perspective it should be no different than sending them an email.  From their perspective they should get an email saying that someone wishes to have a Wave conversation with them, and give them the opportunity to easily and transparently sign up for Wave.

If, for whatever reason they don’t want to use the Wave UI, then I guess they should be able to reply and participate in the conversation through email.

Wave is designed to break down the barriers between different means of communication through its plugin architecture (eg. its Twitter support).  How then could Google not see the importance of breaking down the barriers between Wave and the primary communication medium its supposed to replace: Email?

I’ve found a new URL shortener

I’ve found a new URL shortener.  It is nowhere near as powerful as BudUrl, but it has one overriding advantage.  Take a look at http://to/

Simple bash script to name a tab in iTerm

I like to open a lot of tabs in iTerm, the open source replacement for Apple’s Terminal.app on the Mac. Unfortunately, its easy to forget which is which, as typically they don’t get very descriptive names.

In particular, I have a few scripts I run which will automatically ssh into a remote server, and run screen. When I wanted to find one of these, I’d often have to click several tabs to see which one I wanted (since they would all, rather unhelpfully, be called “ssh”).

So I wrote a simple script, which I call “nametab”, which allows you to name the tab you are in from the command line. You just type something like:

$ nametab New tab name

If you’d like to use this yourself, here is the code:

Just put it in a file in your PATH, and ensure that it is executable (ie. do a chmod u+x nametab).

Making it easy to search Wikipedia from Firefox

This tip will allow you to type “w anything” in your firefox location bar and it will take you straight to the page describing that topic on Wikipeda.

This is far more powerful than a normal search on Wikipedia because it uses Google, although it redirects straight through so you may not even notice it.

Note, this requires Firefox 3 or later.

Here is how:

  1. Go to the Bookmarks menu and click “Organize Bookmarks”
  2. Right-click on “Unsorted Bookmarks” and select “New Bookmark”
  3. Fill in the following fields:
    Name: Wikipedia Search
    Location: http://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=%s%20site%3Aen.wikipedia.org&meta= (all on the same line, no spaces)
    Keyword: w
  4. Click “Add”

Now, test it by typing “w Freenet”, you should be taken straight to the Wiki page.  Because its Google, it will tolerate misspellings, inexact word matches and so on.

Forget “Easy Peasy”, Eeebuntu is far superior

So I finally gave up on “Easy Peasy”, the stupidly named Ubuntu distro for the Asus Eee PC.  The new version is poorly put together, poorly documented, and just plain sloppy.

Instead I tried Eeebuntu, and I’m sorry I didn’t try it earlier.  Finally, an Ubuntu distro that actually seems to be put together by people that know what they are doing.  Installation was a breeze, its an equally recent version of Ubuntu to “Easy Peasy”, and it seems far more polished.

For anyone considering installing Ubuntu on their Eee PC, I recommend Eeebuntu over Easy Peasy any day.

Update (27th Mar 09): A few people have requested more detail in the comments, for this please refer to this previous post.

New version of Ubuntu for the Eee PC released

The Asus Eee is a small, cheap PC (around $350ish) that comes with Windows XP or Linux by default.  Unfortunately the version of Linux that comes with it, Xandros, isn’t very good, but fortunately it can be replaced.  “Ubuntu” is a much better version of Linux, and a team of guys have put together a version of Ubuntu customised for the Eee.

So the team behind this Ubuntu Eee Linux flavor have released a new version, renaming it to Easy Peasy 1.0.  Boy do I hate that name, but I’m sure I can change any branding once its installed.  Someone should create a fork of this just to change the dumb name.

Anyway, their website looks friendly on the surface, but they make it rather difficult to figure out how you actually install the software.  There is a prominent download link for an ISO (a good start), but once you’ve got the ISO, it requires quite a bit of poking around in their wiki and on forums to figure out what you do next.  It certainly wasn’t “easy peasy”.

Well, I figured it out.  You can either burn it to a DVD (the latest release is too big for a CD), but then you need an external DVD drive for the Eee as they don’t have them built in.  Alternatively, you can create a bootable USB stick from Windows or Linux (but not Mac) using these instructions.

I opted for the latter option, but found that the Eee refused to boot from the USB stick I’d just created (an 8GB Cruzer Micro).  Luckily after some digging I discovered the solution.  Hopefully some poor souls searching Google for “easy peasy cruzer usb boot” or something like that will stumble on this.

So I was originally trying to boot from the USB stick by making it the first boot option in the bios, this didn’t work.  I found that if I hit “Esc” on startup I was given the option of booting from the USB stick, and this worked fine.  Not sure if its specific to the Cruzer USB stick, but whatever it is looks like it is something to do with the Eee PC’s bios – not Linux itself.

Once you’ve got it booting it will actually start up Ubuntu, but it will be running directly off the USB stick.  You must then install it using the very simple installation wizard that pops up (its far easier than installing Windows in my experience).

I’ve installed it and initial impressions aren’t good.  The “Easy Peasy” logo looks horribly pixelated, and per some reports it launches the installation tool after its already been installed.  Both issues are trivially rectified, but it is definitely indicitive of a very rushed release.

On the positive side, the wifi seems to be more reliable than the previous version.  More observations to follow…

The free-market, more accurate than polls?

HubDub is a great company based in Edinburgh (where I used to live), who apply the principles of the free market to predicting the outcomes of news stories. I’ve had a good chat with them, and they say that their market tends to be spookily accurate. I’ve heard anecdotal evidence that when this type of market is applied to predicting when internal projects will be completed within Microsoft, they were universally more pessimistic, and more accurate, than the project manager’s estimates.

Here is the current prediction for who will win the US Presidential election, right now it has Obama winning (phew!). It will be interesting to look back and see how accurate it was in retrospect:

Bad Behavior has blocked 1455 access attempts in the last 7 days.