Thursday, July 24, 2008

TopCoder match.

I've been rather busy lately and sort of losing interest in blogging again...
but finally i have something cool to brag about.

I've tried out for first time, and I got second place on a contest there.
TopCoder is a freelancing website that also runs various sorts of programming competitions. The contest that i did was about image recognition.
Given an image (binary, 0s and 1s), which contains 2 different textures in 2 separate regions of image(different textures as in say one squary blobs and other diagonal blobs), your program must identify the regions, and return image with ones for one region and zeroes for other region. For more info see problem description.
The program is run on many such images (500 for "provisional score" and 2000 for final tests) , and is scored by how accurately those are recognized.

This being first time i ever participated in programming contest, i did a lot of mistakes in overall design - at start i tried to write it in same style as i'd do at job (broken down into classes etc), however it was futile - i had no time for proper design, had to cut corners, and it got ugly anyway, plus i wasted time at start trying to make it nice.
#1 solution has average accuracy 97%, mine has average accuracy about 96.6% , or 0.4% from #1. (on my own tests with 10 000 cases) After contest end i discovered a tiny (doable in 2 lines, or 4..6 if as optional thing) change in my code that improves my score to same as #1.
Also, amazingly, top 3 algorithms are very different.
I'm gonna try another contest there soon if i have time, should hopefully do better.